Score:0

Sending Images over DNS Protocol

kz flag
Avv

HTTP protocol at application layer can carry audio, images, etc. in the body over 1 or more TCP responses in case the file size exceeded 4 MB (body size of HTTP response if I am not mistaken).

Now for DNS server, I know it's used for resolving host names, but can it be used to carry images or other multimedia files in its body please?

Thank you.

Massimo avatar
ng flag
It's probably *technically possible* in some very convoluted way (see https://en.wikipedia.org/wiki/IP_over_Avian_Carriers). But why in the world would one do that, apart from "I want to see if I can make it work"?
SamErde avatar
gg flag
I don't think you'll find a legitimate use case for doing this, and not one that is supported by any implementation of the DNS protocol specification. Have you tried IPoAC? ;)
Avv avatar
kz flag
Avv
Thank you for the information.
Patrick Mevzek avatar
cn flag
Since there are "implementations" of TCP over DNS, technically you can exchange through it whatever you want (and it is used in some fashion to exfiltrate data after some exploit). But why would you want to do that, this is the interesting question? DNS is a protocol to distribute data (akin to a decentralized low/slow consistency database) that is mostly needed to discover and find services. It is not tailored to other needs like sending arbitrary files, where HTTP/FTP/SCP/etc. are tailored to that. Remember also that DNS works over UDP AND TCP and UDP has no transport controls
vn flag
https://www.akamai.com/blog/news/introduction-to-dns-data-exfiltration
Score:3
ar flag

HTTP protocol at application layer can carry audio, images, etc. in the body over 1 or more TCP responses in case the file size exceeded 4 MB (body size of HTTP response if I am not mistaken).

First of all packets are small; typically the MTU is 1500 bytes, and this includes headers, so realistically speaking each packet is 12-1450 bytes approximately. Anything larger is sent as multiple TCP packets.

Furthermore, modern protocols such as QUIC (and by extension HTTP/3) uses UDP to transport data, moving the handling of lost packages to the application.

Now for DNS server, I know it's used for resolving host names, but can it be used to carry images or other multimedia files in its body please?

Sure. Create a TXT record with a image, or similar. DNS transports data. It doesn't particularly care about what the data is, in the case of TXT records. For other records, such as A, AAAA and so forth there's some technical constraints on what data the protocol expects. TXT records can be up to 255 bytes, but you can have an unlimited number of them.

Patrick Mevzek avatar
cn flag
"TXT records can be up to 255 bytes, but you can have an unlimited number of them." That is not exactly right. Yes you can have multiple TXT records. But one given TXT record **IS NOT** limited to 255 bytes. On the wire it uses "character-string" which are at most 255 bytes, but it can have more than one of those. So, technically, at the DNS level, one TXT record is almost unlimited (or more precisely up to 65535 bytes since each record has a RDLENGTH on 16 bits storing the length of content). Search TXT record of `icann.org` there is only one, but far longer than 255 bytes...
Avv avatar
kz flag
Avv
@PatrickMevzek. Thank you. So you can send 65535 bytes with one DNS request? Usually, the DNS request is made to resolve host name, but you mean you can add arbitrary data with a request to DNS server over DNS protocol please?
vidarlo avatar
ar flag
@PatrickMevzek thanks for the clarification!
vidarlo avatar
ar flag
@Avv You can transport arbitrary data using *any* protocol. If you want you could encode a image as IPv4-addresses and ship them over DNS. Or you could Base64encode them and send them as telegrams.
Patrick Mevzek avatar
cn flag
@Avv "Usually, the DNS request is made to resolve host name". No. The DNS is an online loosely coupled decentralized database. ONE of its use is to resolve hostnames to IP addresses, but it is far from the only one. Look at `TXT` or `SRV` records for example of other uses. "but you mean you can add arbitrary data with a request to DNS server " Yes but the DNS server has no reason to accept your query and do something with it.
Avv avatar
kz flag
Avv
@PatrickMevzek. Thanks for clarifying the confusion.
Avv avatar
kz flag
Avv
@vidarlo. Appreciate it.
Avv avatar
kz flag
Avv
@PatrickMevzek. Last question please. You have explained more than I need, but for DNS you mentioned that we can send image as IP as if we are sending IP to resolve but it's actually an image, so with that being said, DNS request already as source IP of our device, so why we need also to add IP we want to resolve in the body of DNS? If that is not the case, then does it mean we change the source IP of request to DNS server to image (IP bits represent image data) please?
vidarlo avatar
ar flag
Ignore source IP for a moment. The base point is that the protocol consists of a query and answer, and that the query and answer can contain data. That's what you need to transfer data.
Patrick Mevzek avatar
cn flag
@Avv Sorry I don;t understand your question and we went quite far from being ontopic here. However remember that the client in the DNS protocol is typically the recursive resolver, and it is its IP address that the authoritative nameservers will see, not the IP address of the client as in the human/browser/etc. doing some Internet exchange. Also an IP is only 32 or 128 bits, so it will be hard to encode an image into that. Not sure what you mention that. You can store "arbitrary" data in the DNS using the `TXT` record. It is free form, so you can base64 a binary stream there for example.
Avv avatar
kz flag
Avv
@PatrickMevzek. You said, "Also an IP is only 32 or 128 bits, so it will be hard to encode an image into that.", but vidarlo said "I understan You can transport arbitrary data using any protocol. If you want you could encode a image as IPv4-addresses and ship them over DNS. Or you could Base64encode them and send them as telegrams." So I just got confused. Thanks anyway.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.