Hacking

Experts warn of an emerging Python-based credential harvester named Legion

Legion is an emerging Python-based credential harvester and hacking tool that allows operators to break into various online services.

Cado Labs researchers recently discovered a new Python-based credential harvester and hacking tool, named Legion, which was sold via Telegram. At this time, the sample analyzed by Cado Labs has a low detection rate of 0 on VirusTotal.

Legion is a modular tool that can be used by crooks to hack into various online services. The researchers reported that the tool has modules to support the following functionalities:

  • enumerating vulnerable SMTP servers,
  • conducting Remote Code Execution (RCE),
  • exploiting vulnerable versions of Apache,
  • brute-forcing cPanel and WebHost Manager (WHM) accounts,
  • interacting with Shodan’s API to retrieve a target list (providing you supply an API key) and
  • additional utilities, many of which involve abusing AWS services

Legion is similar to a tool detailed in December by Lacework researchers, which was named AndroxGh0st.

The sample analyzed by Cado Labs is a Python3 script of 21015 lines, it includes configurations for integrating with services such as Twilio and Shodan.

The malware can exfiltrate collected data via Telegram chat using the Telegram Bot API.

The developer behind the tool operates a YouTube channel named “Forza Tools”, which included a series of tutorial videos for using the Legion script. The experts believe that the tool is widely distributed and is likely paid malware. 

Legion exploits web servers running Content Management Systems (CMS), PHP, or PHP-based frameworks such as Laravel. 

“From these targeted servers, the tool uses a number of RegEx patterns to extract credentials for various web services. These include credentials for email providers, cloud service providers (AWS), server management systems, databases and payment systems – such as Stripe and PayPal. Typically, this type of tool would be used to hijack said services and use the infrastructure for mass spamming or opportunistic phishing campaigns.” reads the analysis published by Cado Labs.

The tools can also be used to implant webshells, perform brute-force attacks on CPanel or AWS accounts and send SMS messages to a list of dynamically-generated US mobile numbers.

Below is the list of the services the malware attempts to extract credentials:

Services Targeted
Twilio
Nexmo
Stripe/Paypal (payment API function)
AWS console credentials
AWS SNS, S3 and SES specific credentials
Mailgun
Plivo
Clicksend
Mandrill
Mailjet
MessageBird
Vonage
Nexmo
Exotel
Onesignal
Clickatel
Tokbox
SMTP credentials
Database Administration and CMS credentials (CPanel, WHM, PHPmyadmin)

When used to target insecure or misconfigured web servers, Legion attempts to retrieve AWS credentials and sends out SMS spam messages to users of U.S. mobile carriers such as AT&T, Sprint, T-Mobile, SunCom, US Cellular, Verizon, and Virgin.

The tool is able to deliver SMS spam messages to users of mobile networks in the United States. The malware retrieves the area code for a US state of the user’s choosing from the website www.randomphonenumbers.com

“Since this malware relies heavily on misconfigurations in web server technologies and frameworks such as Laravel, it’s recommended that users of these technologies review their existing security processes and ensure that secrets are appropriately stored. Ideally, if credentials are to be stored in a .env file, this should be stored outside web server directories so that it’s inaccessible from the web.” concludes the report that also provides Indicators of Compromise (IoCs). “AWS users should be aware of Legion’s targeting of IAM and services such as SES.”

Please vote for Security Affairs (https://securityaffairs.com/) as the best European Cybersecurity Blogger Awards 2022 – VOTE FOR YOUR WINNERS
Vote for me in the sections:

  • The Teacher – Most Educational Blog
  • The Entertainer – Most Entertaining Blog
  • The Tech Whizz – Best Technical Blog
  • Best Social Media Account to Follow (@securityaffairs)

Please nominate Security Affairs as your favorite blog.

Nominate here: https://docs.google.com/forms/d/e/1FAIpQLSfaFMkrMlrLhOBsRPKdv56Y4HgC88Bcji4V7OCxCm_OmyPoLw/viewform

Follow me on Twitter: @securityaffairs and Facebook and Mastodon

Pierluigi Paganini

(SecurityAffairs – hacking, Legion)

Pierluigi Paganini

Pierluigi Paganini is member of the ENISA (European Union Agency for Network and Information Security) Threat Landscape Stakeholder Group and Cyber G7 Group, he is also a Security Evangelist, Security Analyst and Freelance Writer. Editor-in-Chief at "Cyber Defense Magazine", Pierluigi is a cyber security expert with over 20 years experience in the field, he is Certified Ethical Hacker at EC Council in London. The passion for writing and a strong belief that security is founded on sharing and awareness led Pierluigi to find the security blog "Security Affairs" recently named a Top National Security Resource for US. Pierluigi is a member of the "The Hacker News" team and he is a writer for some major publications in the field such as Cyber War Zone, ICTTF, Infosec Island, Infosec Institute, The Hacker News Magazine and for many other Security magazines. Author of the Books "The Deep Dark Web" and “Digital Virtual Currency and Bitcoin”.

Recent Posts

New threat actor UAT-9921 deploys VoidLink against enterprise sectors

A new threat actor, UAT-9921, uses the modular VoidLink framework to target technology and financial…

8 hours ago

Attackers exploit BeyondTrust CVE-2026-1731 within hours of PoC release

Attackers quickly targeted BeyondTrust flaw CVE-2026-1731 after a PoC was released, enabling unauthenticated remote code…

15 hours ago

Google: state-backed hackers exploit Gemini AI for cyber recon and attacks

Google says nation-state actors used Gemini AI for reconnaissance and attack support in cyber operations.…

19 hours ago

U.S. CISA adds SolarWinds Web Help Desk, Notepad++, Microsoft Configuration Manager, and Apple devices flaws to its Known Exploited Vulnerabilities catalog

U.S. Cybersecurity and Infrastructure Security Agency (CISA) adds SolarWinds Web Help Desk, Notepad++, Microsoft Configuration…

22 hours ago

Odido confirms massive breach; 6.2 Million customers impacted

Hackers accessed data from 6.2 million Odido accounts, exposing names, contacts, bank details, and ID…

1 day ago

ApolloMD data breach impacts 626,540 people

A May 2025 cyberattack on ApolloMD exposed the personal data of over 626,000 patients linked…

2 days ago

This website uses cookies.