TruffleHog is a legitimate secret-scanning tool that is also abused by attackers to discover and collect credentials in compromised environments. It searches local filesystems and Git history for exposed secrets, including passwords, API keys, GitHub personal access tokens, npm publishing tokens, and cloud-service credentials. Its legitimate security function distinguishes it from the malware that downloads and executes it.
The Shai-Hulud npm supply-chain worm uses TruffleHog on compromised developer workstations and CI/CD runners to automate credential discovery. Malicious package installation scripts download and run the scanner, collect its results, and exfiltrate discovered secrets through the surrounding malware. Harvested credentials support further repository access and package compromise. TruffleHog has also been incorporated into the Famous Chollima-linked StegaBin campaign. These operations involve Windows, Linux, and macOS environments. Package propagation, persistence, remote command execution, and destructive behavior belong to the associated malware rather than to TruffleHog itself.
2 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
The first IP to touch the stolen keys ran TruffleHog to validate that the credentials were live. The TruffleHog user agent appears directly in CloudTrail.
“...contained nine modules enabling keylogging, credential theft, browser and cryptocurrency exfiltration, TruffleHog secrets scanner downloads, and persistence.”
40 distinct techniques documented for this family, organized by ATT&CK tactic.
PentestMCP on port 8000 focuses on reconnaissance and crawling. Pentest-Recon on port 8001 expands this with secrets detection and historical URL mining using TruffleHog, GitLeaks, and the Wayback Machine.
“Used GitHub access tokens stolen from TruffleHog to authenticate to GitHub API and enumerate repositories accessible to the victim.”
The Android APK scanning pipeline was paired with a second credential-harvesting stream focused on GitHub. The attackers collected organization email addresses and searched for exposed GitHub Personal Access Tokens.
«встраиваю сканирование публичных репозиториев в recon-фазу каждого внешнего пентеста… секреты утекают обычным коммитом»; «проверяем не только основной репозиторий, но и все его форки через GitHub API».
yar is an OSINT tool for reconnaissance of repositories/users/organizations on Github. Yar clones repositories of users/organizations given to it and goes through the whole commit history in order of commit time, in search for secrets/tokens/passwords
Whenever yar finds a secret, it will print it out for you to further assess. Yar searches for secrets either by regex, entropy or both
“With those credentials, you access services” and “Eventually we found a working pair and got into a database.”
APT5 has accessed Microsoft M365 cloud environments using stolen credentials.
A malicious update to @ctrl/tinycolor (2.2M weekly downloads) was detected on npm as part of a broader supply chain attack that impacted more than 40 packages spanning multiple maintainers.
“Shai-hulud deploys a ‘bundle.js’ script that downloads and executes TruffleHog.”
“With those credentials, you access services” and “Eventually we found a working pair and got into a database.”
APT5 has accessed Microsoft M365 cloud environments using stolen credentials.
In the next stage of the attack, they used TruffleHog (a tool for scanning and validating cloud credentials) to search for additional secrets, then attached a newly created access key to an existing user to evade detection before conducting further reconnaissance and stealing data.
In the next stage of the attack, they used TruffleHog (a tool for scanning and validating cloud credentials) to search for additional secrets, then attached a newly created access key to an existing user to evade detection before conducting further reconnaissance and stealing data.
“With those credentials, you access services” and “Eventually we found a working pair and got into a database.”
APT5 has accessed Microsoft M365 cloud environments using stolen credentials.
The attack employs several evasion techniques including silent error handling (swallowed via catch {} blocks), no logging output, and disguising TruffleHog execution as a legitimate "security scan."
“With those credentials, you access services” and “Eventually we found a working pair and got into a database.”
APT5 has accessed Microsoft M365 cloud environments using stolen credentials.
схема работы всегда одинакова: декомпиляция, например в JADX, и поиск по регуляркам.
threat actors used the Trufflehog open source tool to validate those credentials. The team observed Trufflehog validation activity for AWS access keys, Azure application secrets, and various SaaS tokens.
“Shai-Hulud can self-replicate and steal credentials, tokens, and repository secrets; GitHub access tokens, Continuous Integration (CI)/Continuous Delivery (CD) pipeline secrets.”
The simulation confirmed the exact set of exfiltrated credentials: two distinct AWS key pairs with broad permissions
From there the group reached a large BigQuery instance, used the secret-scanning tool TruffleHog to find further credentials.
«Конфигурации IaC … с hardcoded secrets», «Скрипты деплоя с токенами CI/CD», «Файлы .env и .config», «Jupyter Notebook с API-ключами», «SSH-ключи и сертификаты, захваченные git add .»
CISA still hadn’t invalidated an RSA private key exposed in the Private-CISA repo that granted access to a GitHub app which is owned by the CISA enterprise account and installed on the CISA-IT GitHub organization with full access to all code repositories.
Git Repositories: Scans commit history for buried secrets.
Once installed, the malicious packages will attempt to collect and exfiltrate credentials and tokens for NPM GitHub, Azure, GCP, and AWS accounts
The attacker then enumerated IAM users, roles, Lambda functions, DynamoDB tables, CloudFormation stacks, and scanned every S3 bucket's ACL and public access configuration.
The first IP to touch the stolen keys ran TruffleHog to validate that the credentials were live. The attacker then enumerated IAM users, roles, Lambda functions, DynamoDB tables, CloudFormation stacks, and scanned every S3 bucket's ACL and public access configuration.
the malware runs these tools against the compromised server's filesystem, including: Git Repositories... Directories: /tmp, /var/www, /opt, /etc , and user home directories.
Within 24 hours of validating stolen secrets, the group transitions to discovery operations in compromised AWS environments.
TruffleHog validation attempts may appear as rapid sequential API calls testing credential validity across multiple services.
When executed, the infected packages are reported to attempt downloading and running TruffleHog, an open-source tool to scan for and collect available tokens and secrets from the host.
T1580: Cloud Infrastructure Discovery The adversary performed enumeration of the environment, including gathering OneDrive metadata (drive IDs and child item counts) and user roles.
The attacker scanned 24 S3 buckets, including 9 terraform state buckets.
The attacker scanned 24 S3 buckets, including 9 terraform state buckets.
The content repeatedly describes threat actors and malware collecting, stealing, identifying, copying, or staging files, documents, credentials, logs, databases, and other information from compromised hosts or local systems.
The malware uses TruffleHog’s filesystem scanner to sweep the victim’s home directory for hardcoded secrets
“Scan a GitHub repo including issues and pull requests ... issue text, comments, PR bodies, and PR comments.”
From there the group reached a large BigQuery instance... and claimed close to a petabyte of stolen data including call records, voice recordings and source code.
“Downloaded and ran TruffleHog on infected hosts to scan for secrets and credentials.”
Cieľom útoku je zneužiť nástroj TruffleHog na vyhľadávanie citlivých údajov... a odoslať ich na server pod kontrolou útočníka.
attackers stole an AWS API key that gave them control over AWS accounts. From there, they used Trufflehog to discover more AWS credentials, carried out reconnaissance activities, and then exfiltrated data from the environment.
creates GitHub actions for data exfiltration through webhook sites... The malware employed dual exfiltration channels, creating dedicated GitHub repositories and implementing GitHub Actions workflows with webhook endpoints, while encoding sensitive data in GitHub Actions logs.
harvests secrets using TruffleHog, exfiltrates to attacker-controlled GitHub repos
5 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
27 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.