Categories: Technology

Hacker disclosed GitHub secret key hunter – TruffleHog

A tool for finding secret keys with varying cryptographic strength in github repositories is published by Dylan Ayrey.

The tool, named as TruffleHog, can search for and find keys containing high-entropy strings by digging deep into commit history and branches, as per developer

TruffleHog’s search capabilities make it “effective at finding secrets accidentally committed that contain high entropy,” Ayrey says, and the tool needs nothing more than GitPython to work.

Ayrey commented:

This module will go through the entire commit history of each branch, and check each diff from each commit, and evaluate the Shannon entropy for both the base64 character set and hexidecimal character set for every blob of text greater than 20 characters comprised of those character sets in each diff.

TruffleHog calculates entropy levels using a Shannon Entropy (.PDF) calculator. The entropy levels of keys are important, as the information required to decide unknown key variables can alter how difficult it is to crack.

If a high-entropy string is detected, the string is printed to the screen.

Users of TruffleHog said in a Reddit discussion topic that Amazon already uses the tool to preemptively search GitHub for Amazon Web Services (AWS) keys accidentally connected to public repositories, which prevents attackers from snatching the keys, spinning up vast AWS instances and leaving the owners with the bill.

Setup:

GitPython is the only requirement, which can be installed with the following

pip install -r requirements.txt

How to use Truffle Hog:

python truffleHog.py https://github.com/dxa4481/truffleHog.git


Why the name Truffle Hog?

Truffle Hog is a domestic pig used for locating and extracting a type of tuber known as truffles from temperate forests in Europe and North America. The pigs have a good sense of smell and can find truffles from as deep as three feet underground.

It is thought that the natural sex hormones of the male pig are like the smell of the truffles and pigs have a natural affinity for rooting in the earth for food. They are trained to hunt truffles by walking on a leash through suitable groves with a keeper.

Gurubaran

Gurubaran is a co-founder of Cyber Security News and GBHackers On Security. He has 10+ years of experience as a Security Consultant, Editor, and Analyst in cybersecurity, technology, and communications.

Recent Posts

Update Alert: Google Warns of Critical Android Vulnerabilities Under Exploit

Google’s March 2025 Android Security Bulletin has unveiled two critical vulnerabilities—CVE-2024-43093 and CVE-2024-50302—currently under limited,…

28 minutes ago

BigAnt Server 0-Day Vulnerability Lets Attackers Run Malicious Code Remotely

A critical vulnerability in BigAntSoft's enterprise chat server software has exposed ~50 internet-facing systems to…

49 minutes ago

Bubba AI, Inc. is Launching Comp AI to Help 100,000 Startups Get SOC 2 Compliant by 2032.

With the growing importance of security compliance for startups, more companies are seeking to achieve…

3 hours ago

IBM Storage Virtualize Flaws Allow Remote Code Execution

Two critical security flaws in IBM Storage Virtualize products could enable attackers to bypass authentication…

3 hours ago

Progress WhatsUp Gold Path Traversal Vulnerability Exposes Systems to Remote code Execution

A newly disclosed path traversal vulnerability (CVE-2024-4885) in Progress Software’s WhatsUp Gold network monitoring solution…

3 hours ago

CISA Alerts on Active Exploitation of Cisco Small Business Router Flaw

The U.S. Cybersecurity and Infrastructure Security Agency (CISA) issued an urgent warning on March 3,…

4 hours ago