www.darkreading.com Open in urlscan Pro
2606:4700::6811:7763  Public Scan

URL: https://www.darkreading.com/application-security/novel-pypi-malware-compiled-python-bytecode-evade-detection
Submission: On June 02 via api from TR — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

The Edge
DR Tech
Sections
Close
Back
Sections
Featured Sections
The Edge
Dark Reading Technology
Attacks / Breaches

Cloud

ICS/OT

Remote Workforce

Perimeter

Analytics
Security Monitoring

Security Monitoring
App Sec
Database Security

Database Security
Risk
Compliance

Compliance
Threat Intelligence

Endpoint
AuthenticationMobile SecurityPrivacy

AuthenticationMobile SecurityPrivacy
Vulnerabilities / Threats
Advanced ThreatsInsider ThreatsVulnerability Management

Advanced ThreatsInsider ThreatsVulnerability Management
Operations
Identity & Access ManagementCareers & People

Identity & Access ManagementCareers & People
Physical Security

IoT

DR Global
Middle East & Africa

Middle East & Africa
Black Hat news
Omdia Research
Security Now
Events
Close
Back
Events
Events
 * SecTor - Canada's IT Security Conference Oct 23-26 - Learn More
   
 * Anatomy of a Data Breach - A Dark Reading June 22 Event
   

Webinars
 * Next-Generation Supply Chain Security
   Jun 07, 2023
 * Here's What Zero Trust Really Means
   Jun 13, 2023

Resources
Close
Back
Resources
Dark Reading Library >
Webinars >
Reports >
Slideshows >
White Papers >
Partner Perspectives: Microsoft
Tech Library >

Newsletter Sign-Up

The Edge
DR Tech
Sections
Close
Back
Sections
Featured Sections
The Edge
Dark Reading Technology
Attacks / Breaches

Cloud

ICS/OT

Remote Workforce

Perimeter

Analytics
Security Monitoring

Security Monitoring
App Sec
Database Security

Database Security
Risk
Compliance

Compliance
Threat Intelligence

Endpoint
AuthenticationMobile SecurityPrivacy

AuthenticationMobile SecurityPrivacy
Vulnerabilities / Threats
Advanced ThreatsInsider ThreatsVulnerability Management

Advanced ThreatsInsider ThreatsVulnerability Management
Operations
Identity & Access ManagementCareers & People

Identity & Access ManagementCareers & People
Physical Security

IoT

DR Global
Middle East & Africa

Middle East & Africa
Black Hat news
Omdia Research
Security Now
Events
Close
Back
Events
Events
 * SecTor - Canada's IT Security Conference Oct 23-26 - Learn More
   
 * Anatomy of a Data Breach - A Dark Reading June 22 Event
   

Webinars
 * Next-Generation Supply Chain Security
   Jun 07, 2023
 * Here's What Zero Trust Really Means
   Jun 13, 2023

Resources
Close
Back
Resources
Dark Reading Library >
Webinars >
Reports >
Slideshows >
White Papers >
Partner Perspectives: Microsoft
Tech Library >
The Edge
DR Tech
Sections
Close
Back
Sections
Featured Sections
The Edge
Dark Reading Technology
Attacks / Breaches

Cloud

ICS/OT

Remote Workforce

Perimeter

Analytics
Security Monitoring

Security Monitoring
App Sec
Database Security

Database Security
Risk
Compliance

Compliance
Threat Intelligence

Endpoint
AuthenticationMobile SecurityPrivacy

AuthenticationMobile SecurityPrivacy
Vulnerabilities / Threats
Advanced ThreatsInsider ThreatsVulnerability Management

Advanced ThreatsInsider ThreatsVulnerability Management
Operations
Identity & Access ManagementCareers & People

Identity & Access ManagementCareers & People
Physical Security

IoT

DR Global
Middle East & Africa

Middle East & Africa
Black Hat news
Omdia Research
Security Now
Events
Close
Back
Events
Events
 * SecTor - Canada's IT Security Conference Oct 23-26 - Learn More
   
 * Anatomy of a Data Breach - A Dark Reading June 22 Event
   

Webinars
 * Next-Generation Supply Chain Security
   Jun 07, 2023
 * Here's What Zero Trust Really Means
   Jun 13, 2023

Resources
Close
Back
Resources
Dark Reading Library >
Webinars >
Reports >
Slideshows >
White Papers >
Partner Perspectives: Microsoft
Tech Library >

--------------------------------------------------------------------------------

Newsletter Sign-Up
SEARCH
A minimum of 3 characters are required to be typed in the search bar in order to
perform a search.




Announcements
 1. 
 2. 
 3. 

Event
How to Launch a Threat Hunting Program | Webinar <REGISTER>
Event
How to Accelerate XDR Outcomes: Bridging the Gap Between Network and Endpoint |
Webinar <REGISTER>
Report
Black Hat USA 2022 Attendee Report | Supply Chain & Cloud Security Risks Are Top
of Mind | <READ IT NOW>
PreviousNext

Application Security

4 MIN READ

News



NOVEL PYPI MALWARE USES COMPILED PYTHON BYTECODE TO EVADE DETECTION

In an already fraught environment surrounding the popular Python programming
language software package manager, hackers are coming up with new ways to sneak
malicious goodies past cybersecurity buffers.
Nate Nelson
Contributing Writer, Dark Reading
June 01, 2023
Source: Steve Taylor ARPS via Alamy Stock Photo
PDF


In a new twist on software supply chain attacks, researchers have discovered a
Python package hiding malware inside of compiled code, allowing it to evade
ordinary detection measures.



On April 17, researchers reported a packaged called "fshec2" to the
administrators of the Python open source repository PyPI. Malicious packages
aren't new — or particularly rare — in PyPI, but unlike the lot of them, fshec2
contained all of its malicious functionality inside of its compiled code, making
it hard to spot as bad news.

The PyPI admins immediately removed the package. In so doing, they "also
recognized this type of attack as interesting and acknowledged that it had not
been previously seen," Karlo Zanki, reverse engineer at ReversingLabs, wrote in
a report published June 1.

"This behavior is a bit more sophisticated, and it shows that the attackers are
evolving and paying attention to the better detections that are being rolled
out," says Ashlee Benge, director of threat intelligence advocacy at
ReversingLabs, adding that "we're probably going to continue to see this kind of
attack increase in the future."




UNPACKING FSHEC2

The genius of fshec2 is in how it dispenses with basic conventions of good
hacker hygiene.



For example, bad guys tend not to distribute overt malware out on the Web —
that'd be ham-handed. Instead, they plant tools which, upon hooking into a
target computer, connect back to their C2 servers and trigger the download of
malicious code — that can be ransomware, an infostealer, you name it.

Furthermore, to hide their true intentions, hackers will often use code
obfuscation — taking any clues the good guys might pick up on, and turning it to
spaghetti.

By contrast, fshec2 front loaded its malicious functionalities, and didn't rely
on obfuscation tools at all.

The package contained three files — two unexceptional source code files, and a
third, more interesting file, "full.pyc." Within full.pyc was a method called
"get_path," which, the researchers explained, "performs some of the common
malicious functions observed in other malicious PyPI packages we have analyzed,"
including collecting usernames, hostnames, and directory listings, and
downloading commands from a remote server.



How did fshec2 manage to hide the maliciousness of get_path? The crucial bit
here is that PYC files contain not source code, but compiled bytecode.


THE PROBLEM WITH BYTECODE

Bytecode is a representation of Python, compiled as a set of instructions for
the Python Virtual Machine. In a simplified sense, it exists somewhere between
source code and being a machine binary.

Raw bytecode isn't friendly to the human eye — get_path, for example, can't be
found in readable form anywhere inside fshec2. And so it's also able to skirt by
software scanners.

PyPI doesn't yet account for malware hidden in bytecode, Benge explains, because
"over the last decade, these files have gotten increasingly more complicated and
huge. It's really slow, often, to try to scan such a big file. So it creates
this dilemma: how much lag do you want your user to experience?"

As for third-party security software, she adds, "another problem is file type. I
couldn't even tell you how many file types there are at this point — there are
all sorts of obscure ones. And oftentimes, security solutions don't actually
have the capabilities to look at the kinds less commonly seen."


PYPI: FIGHTING BACK AGAINST CYBERATTACKERS

"Right now, poor PyPI is really under fire," Benge remarks. "There's been a huge
increase in this type of attack generally, where we're seeing malicious Python
libraries be leveraged to serve malware."

In the past year especially, threat actors have been inventing new kinds of
malicious Python packages, and even openly advertising their evil goods on the
repo. The bad news has come so often for PyPI that, earlier this month, the
security community interpreted a routine shutdown as a massive cyberattack.

In response, the Python Software Foundation has been investing in security more
than ever, creating new roles for dedicated security experts. And last week,
PyPI announced that by year's end, users who upload and maintain projects and
organizations will be required to protect their accounts with two-factor
authentication.

Benge is optimistic about these developments. "Now it becomes a little more
difficult than just pushing a malicious library out to PyPI and waiting for
someone to download it. Now we're seeing that these guys have to work a little
harder."

Threat IntelligenceAttacks/Breaches
Keep up with the latest cybersecurity threats, newly-discovered vulnerabilities,
data breach information, and emerging trends. Delivered daily or weekly right to
your email inbox.
Subscribe

More Insights
White Papers
 * 
   Invicti AppSec Indicator: Tuning Out the AppSec Noise is All About DAST
 * 
   Every Minute Matters: Real-World Incident Response Timelines In Action

More White Papers
Webinars
 * 
   Next-Generation Supply Chain Security
 * 
   Here's What Zero Trust Really Means

More Webinars
Reports
 * 
   Everything You Need to Know About DNS Attacks
 * 
   Securing the Remote Worker: How to Mitigate Off-Site Cyberattacks

More Reports

Editors' Choice
Russia's War in Ukraine Shows Cyberattacks Can Be War Crimes
Andrada Fiscutean, Contributing Writer, Dark Reading
'Volt Typhoon' China-Backed APT Infiltrates US Critical Infrastructure Orgs
Tara Seals, Managing Editor, News, Dark Reading
CISO Criminalization, Vague Cyber Disclosure Rules Create Angst for Security
Teams
Becky Bracken, Editor, Dark Reading
Bridgestone CISO: Lessons From Ransomware Attack Include Acting, Not Thinking
Jai Vijayan, Contributing Writer, Dark Reading
Webinars
 * Next-Generation Supply Chain Security
 * Here's What Zero Trust Really Means
 * Mastering Endpoint Security: The Power of Least Privilege
 * The Future is CNAPP: Cloud Security From Prevention To Threat Detection
 * Secrets to a Successful Managed Security Service Provider Relationship

More Webinars
Reports
 * Everything You Need to Know About DNS Attacks
 * Securing the Remote Worker: How to Mitigate Off-Site Cyberattacks
 * How Enterprises Are Managing Application Security Risks in a Heightened
   Threat Environment
 * The 10 Most Impactful Types of Vulnerabilities for Enterprises Today
 * Shoring Up the Software Supply Chain Across Enterprise Applications

More Reports

White Papers
 * Invicti AppSec Indicator: Tuning Out the AppSec Noise is All About DAST
 * Every Minute Matters: Real-World Incident Response Timelines In Action
 * The State of Cybersecurity: 2023 Trends Report
 * 2023 Gartner Market Guide for Cloud-Native Application Protection Platforms
   (CNAPP)
 * Top Ten Tips: Securing Multi-Cloud with Modern CSPM

More White Papers
Events
 * SecTor - Canada's IT Security Conference Oct 23-26 - Learn More
 * Anatomy of a Data Breach - A Dark Reading June 22 Event
 * Black Hat USA - August 5-10 - Learn More

More Events
More Insights
White Papers
 * 
   Invicti AppSec Indicator: Tuning Out the AppSec Noise is All About DAST
 * 
   Every Minute Matters: Real-World Incident Response Timelines In Action

More White Papers
Webinars
 * 
   Next-Generation Supply Chain Security
 * 
   Here's What Zero Trust Really Means

More Webinars
Reports
 * 
   Everything You Need to Know About DNS Attacks
 * 
   Securing the Remote Worker: How to Mitigate Off-Site Cyberattacks

More Reports

DISCOVER MORE FROM INFORMA TECH

 * Interop
 * InformationWeek
 * Network Computing
 * ITPro Today

 * Data Center Knowledge
 * Black Hat
 * Omdia

WORKING WITH US

 * About Us
 * Advertise
 * Reprints

FOLLOW DARK READING ON SOCIAL

 * 
 * 
 * 
 * 
 * 
 * 


 * Home
 * Cookies
 * Privacy
 * Terms



Copyright © 2023 Informa PLC Informa UK Limited is a company registered in
England and Wales with company number 1072954 whose registered office is 5
Howick Place, London, SW1P 1WG.





Cookies Button


ABOUT COOKIES ON THIS SITE

We and our partners use cookies to enhance your website experience, learn how
our site is used, offer personalised features, measure the effectiveness of our
services, and tailor content and ads to your interests while you navigate on the
web or interact with us across devices. You can choose to accept all of these
cookies or only essential cookies. To learn more or manage your preferences,
click “Settings”. For further information about the data we collect from you,
please see our Privacy Policy

Accept All
Settings



COOKIE PREFERENCE CENTER

When you visit any website, it may store or retrieve information on your
browser, mostly in the form of cookies. This information might be about you,
your preferences or your device and is mostly used to make the site work as you
expect it to. The information does not usually directly identify you, but it can
give you a more personalized web experience. Because we respect your right to
privacy, you can choose not to allow some types of cookies. Click on the
different category headings to find out more and change our default settings.
However, blocking some types of cookies may impact your experience of the site
and the services we are able to offer.
More information
Allow All


MANAGE CONSENT PREFERENCES

STRICTLY NECESSARY COOKIES

Always Active

These cookies are necessary for the website to function and cannot be switched
off in our systems. They are usually only set in response to actions made by you
which amount to a request for services, such as setting your privacy
preferences, logging in or filling in forms.    You can set your browser to
block or alert you about these cookies, but some parts of the site will not then
work. These cookies do not store any personally identifiable information.

Cookies Details‎

PERFORMANCE COOKIES

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and
improve the performance of our site. They help us to know which pages are the
most and least popular and see how visitors move around the site.    All
information these cookies collect is aggregated and therefore anonymous. If you
do not allow these cookies we will not know when you have visited our site, and
will not be able to monitor its performance.

Cookies Details‎

FUNCTIONAL COOKIES

Functional Cookies

These cookies enable the website to provide enhanced functionality and
personalisation. They may be set by us or by third party providers whose
services we have added to our pages.    If you do not allow these cookies then
some or all of these services may not function properly.

Cookies Details‎

TARGETING COOKIES

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may
be used by those companies to build a profile of your interests and show you
relevant adverts on other sites.    They do not store directly personal
information, but are based on uniquely identifying your browser and internet
device. If you do not allow these cookies, you will experience less targeted
advertising.

Cookies Details‎
Back Button


BACK



Search Icon
Filter Icon

Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label

 * 
   
   View Cookies
   
    * Name
      cookie name

Confirm My Choices