Cyber Security News

Hackers Can Hide Images in Text Data and Embeds Directly into DNS TXT Records

A novel method has emerged that demonstrates how digital images can be seamlessly embedded within DNS TXT records, effectively transforming domain name infrastructure into an unconventional image storage system. 

This innovative technique, dubbed “dnsimg,” represents a novel approach to data concealment that leverages the ubiquitous DNS protocol to store visual content in plain sight across the internet’s foundational infrastructure.

Hiding Images in DNS TXT Records

According to the Asher Falcon Report, the core mechanism behind this revolutionary technique centers on converting image files into hexadecimal or Base64 encoded text strings that can be stored within DNS TXT records. 

The process begins with extracting the raw binary data from image files using the xxd command-line utility, specifically employing xxd -p output.jpg > output.txt to generate hexadecimal representations of the image data. 

While this hexadecimal approach requires approximately twice the storage space compared to Base64 encoding, which only increases file size by 1.33 times, it provides a straightforward implementation for proof-of-concept demonstrations.

The technique addresses the inherent limitations of DNS TXT records by implementing an intelligent data chunking system. Since individual TXT records are constrained to 2048 characters maximum, larger images must be systematically divided into manageable segments. 

A sophisticated Python script automates this process, calculating the total number of required chunks using total = int(len(image)/2048)+1 and creating individual DNS records for each segment. 

Each chunk is assigned a unique subdomain identifier following the pattern dnsimg-{chunk_number}.{domain}, while an additional dnsimg-count record maintains the total chunk count for reconstruction purposes.

The practical deployment of this image storage technique requires careful consideration of DNS infrastructure limitations and propagation delays. 

Cloudflare DNS services, commonly used for testing implementations, automatically subdivides records that exceed their internal limits, necessitating concatenation during the retrieval process. 

The implementation demonstrates remarkable resilience through asynchronous data fetching using the dig command, enabling parallel retrieval of multiple chunks to reconstruct the original image efficiently.

The retrieval mechanism employs multithreaded Python scripts that query each chunk simultaneously using dig +short dnsimg-{chunk_number}.{domain} TXT commands. 

This approach significantly reduces reconstruction time while providing visual feedback through color-coded progress indicators that display the status of each chunk during the fetching process.

The system demonstrates robust error handling capabilities, accounting for network delays and temporary DNS propagation issues that might cause individual chunks to become temporarily unavailable.

Testing reveals both the potential and constraints of DNS-based image storage. Successful demonstrations include storing and retrieving images across 21 chunks of 2048 characters each, effectively proving the viability of the concept for moderate-resolution images. 

The technique successfully reconstructed images after typical DNS propagation delays of approximately 10-15 minutes, though initial attempts often produced corrupted results due to incomplete record availability.

However, significant limitations emerge when attempting to store larger files. Images exceeding 1MB in size encounter hard limits, likely imposed by DNS provider policies or fundamental DNS protocol constraints. 

These boundaries suggest that while the technique proves conceptually sound for smaller images or critical data concealment scenarios, it remains impractical for high-resolution media storage. 

The innovative approach nonetheless opens intriguing possibilities for steganographic applications and demonstrates the creative potential of repurposing existing internet infrastructure for unconventional data storage methodologies.

Live Credential Theft Attack Unmask & Instant Defense – Free Webinar

Guru Baran

Gurubaran KS is a cybersecurity analyst, and Journalist with a strong focus on emerging threats and digital defense strategies. He is the Co-Founder and Editor-in-Chief of Cyber Security News, where he leads editorial coverage on global cybersecurity developments.

Recent Posts

Hackers Target AI Infrastructure With RCE, Prompt Injection and API Key Theft

Hackers are actively probing AI systems, turning exposed gateways and agent tools into routes for…

4 hours ago

Hackers Make Phishing Pages Change Their Code Every Time Someone Opens Them

Hackers are making some phishing pages harder to track by changing the code delivered to…

4 hours ago

Iran-Linked Hackers Reportedly Knock UK Power Plant Offline for Four Days

A cyber incident reportedly forced a British power plant to halt operations for about four…

5 hours ago

Russian Hackers Use New HOOKEDGE Malware to Spy on European Defense and Diplomatic Targets

Russian hackers have used a new backdoor called HOOKEDGE to target defense manufacturers, government bodies,…

6 hours ago

Ransomware Gang Claims AI Can Analyze 700GB of Stolen Data Every Hour

TITAN ransomware is pairing file encryption with an ambitious claim: artificial intelligence that can sort…

6 hours ago

Hackers Compromise Hundreds of WordPress Sites to Deploy Amatera Stealer via ClickFix

A fake student resume is being used to place a remote-access tool on researchers’ Windows…

7 hours ago