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

Cryptocurrencies and cybercrime: A critical intermingling

As cryptocurrencies have grown in popularity, there has also been growing concern about cybercrime involvement…

7 mins ago

Kaiser Permanente data breach may have impacted 13.4 million patients

Healthcare service provider Kaiser Permanente disclosed a security breach that may impact 13.4 million individuals…

28 mins ago

Over 1,400 CrushFTP internet-facing servers vulnerable to CVE-2024-4040 bug

Over 1,400 CrushFTP internet-facing servers are vulnerable to attacks exploiting recently disclosed CVE-2024-4040 vulnerability. Over…

3 hours ago

Sweden’s liquor supply severely impacted by ransomware attack on logistics company

A ransomware attack on a Swedish logistics company Skanlog severely impacted the country's liquor supply. …

5 hours ago

CISA adds Cisco ASA and FTD and CrushFTP VFS flaws to its Known Exploited Vulnerabilities catalog

CISA adds Cisco ASA and FTD and CrushFTP VFS vulnerabilities to its Known Exploited Vulnerabilities…

16 hours ago

CISA adds Microsoft Windows Print Spooler flaw to its Known Exploited Vulnerabilities catalog

U.S. CISA added the Windows Print Spooler flaw CVE-2022-38028 to its Known Exploited Vulnerabilities catalog.…

22 hours ago

This website uses cookies.