A novel method for embedding images directly into DNS TXT records has gained attention for its creative use of infrastructure typically reserved for domain management.
While demonstrating technical ingenuity, the approach highlights inherent limitations and potential risks associated with repurposing core internet protocols.
How DNS Image Hosting Works
The technique converts images into hexadecimal or Base64 format, splits them into chunks, and stores them across multiple TXT records.
As demonstrated in a proof-of-concept project, a Python script fragments image data into 2,048-character segments compatible with DNS constraints.
Each chunk is assigned to subdomains like dnsimg-1.example.com
, with a separate record tracking total chunks (dnsimg-count.example.com
).
Reconstruction involves querying all records simultaneously via tools like dig
reassembling the data:
pythonsubprocess.run(["dig", "+short", f"dnsimg-{chunkIndex+1}.{domain}", "TXT"])
Cloudflare’s DNS imposes practical limits – 1,000 TXT records per domain caps storage at ~2MB using standard 2KB chunks.
While RFC standards permit up to 64KB per TXT record via TCP, most implementations use UDP, limited to ~1,500 bytes.

Implementation Challenges
Key technical hurdles include:
- Chunk Management: Base64 encoding reduces storage needs by 33% compared to hexadecimal, but still requires precise splitting to avoid data corruption
- Propagation Delays: DNS changes can take 48+ hours to fully propagate due to caching mechanisms
- Size Limitations: Practical implementations max out at ~2MB on Cloudflare, though theoretical limits reach 64KB per record
Developers must also handle error checking for missing chunks and implement asynchronous requests to mitigate latency.
One project used threading to parallelize DNS queries:
pythonthreads = [threading.Thread(target=getChunk) for _ in range(size)]
[t.start() for t in threads]
Security Risks and Mitigation Strategies
Risk Factor | Impact | Mitigation |
---|---|---|
DNS Amplification | Could enable DDoS attacks | Rate limit TXT queries |
Data Exfiltration | Hidden communication channel | Monitor unusual DNS pattern |
Cache Poisoning | Modified records spread via DNS | Implement DNSSEC |
Service Disruption | Overloaded DNS servers | Monitor unusual DNS patterns |
The method’s potential for abuse has drawn scrutiny, as TXT records could conceal malicious payloads.
While Cloudflare’s record limits curb extreme misuse, security experts warn that even small data leaks could bypass traditional monitoring.
This DNS repurposing showcases the infrastructure’s flexible nature but underscores the need for guardrails.
As one developer noted, “Using DNS records as a simple database is clever, but security must be prioritized”.
While unlikely to replace conventional hosting, it presents intriguing possibilities for decentralized storage, provided risks are adequately addressed.
Find this Story Interesting! Follow us on LinkedIn and X to Get More Instant Updates