dnscat2 icon indicating copy to clipboard operation
dnscat2 copied to clipboard

DNS server returned an unknown character in the string: 0xc1

Open DrDoof opened this issue 9 years ago • 12 comments

Sometimes I recive error

DNS server returned an unknown character in the string: 0xc1 Unrecoverable error in libs/dns.c(92): Couldn't process string

on client while establishing ssh session.

DrDoof avatar May 17 '16 15:05 DrDoof

Does it keep working, or does it fail at that point?

Can you get me a packet capture while it's happening? Running the client with --packet-trace and possibly -d should cover that.

More info on how to capture all the bug report info I need: https://github.com/iagox86/dnscat2/blob/master/doc/how_to_bug_report.md

On Tue, May 17, 2016 at 8:13 AM, DrDoof [email protected] wrote:

Sometimes I recive error

DNS server returned an unknown character in the string: 0xc1

on client while establishing ssh session.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/iagox86/dnscat2/issues/95

iagox86 avatar May 17 '16 15:05 iagox86

I had the same issue. In my setup, the clients are connecting first to windows dns servers, which forwards to bind servers for external resolving. If I use the windows server in my resolv.conf, I experience this issue. If I change it by the bind server, no issue anymore, so I suppose that windows dns server is changing something somewhere.

I have a client log if you need it :)

sam-dumont avatar May 23 '16 12:05 sam-dumont

Interesting! Does it break the connection, or does it just print a warning?

I'd like to be able to replicate it (or even just see a pcap) so I can make sure it's being handled properly.

On Mon, May 23, 2016 at 5:12 AM, samueldumont [email protected] wrote:

I had the same issue. In my setup, the clients are connecting first to windows dns servers, which forwards to bind servers for external resolving. If I use the windows server in my resolv.conf, I experience this issue. If I change it by the bind server, no issue anymore, so I suppose that windows dns server is changing something somewhere.

I have a client log if you need it :)

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/iagox86/dnscat2/issues/95#issuecomment-220963267

iagox86 avatar May 23 '16 17:05 iagox86

It breaks the connection and the client crashes :( I will generate a pcap and send it to you in the next days.

sam-dumont avatar May 24 '16 05:05 sam-dumont

Ahh, that sucks! A Pcap would be great, I should look into making that a "softer" error.

On Mon, May 23, 2016 at 10:48 PM, samueldumont [email protected] wrote:

It breaks the connection and the client crashes :( I will generate a pcap and send it to you in the next days.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/iagox86/dnscat2/issues/95#issuecomment-221172647

iagox86 avatar May 24 '16 16:05 iagox86

Hi,

I face the same problem. The client crashes when it receives a MX response that was forwarded by a windows dns server. I created a log with --packet-trace and -d. Taking a quick look at the source code (dns.c), the problem seems to occure while parsing the dns label length.

dnscat-windns.txt

0x71 avatar Nov 01 '16 10:11 0x71

Same problem here Are there any solutions yet?

osakaaa avatar Nov 22 '16 11:11 osakaaa

I am also very interested in the solution. If it is the MX response, is there any way to tell DNScat to not use MX responses? For example, when the DNS driver gets created it shows "type = TXT, CNAME, MX". Is there a flag that tells it to use just CNAME?

dnscat2 is great, by the way. Thanks for sharing! 💃


update: I figured out the type flag. Duh :) . TXT record seems to be fine. I wonder if this is because the TXT record allows more data?

slohin-st avatar Mar 23 '17 20:03 slohin-st

Yeah, there is; on the client:

Driver options:
 --dns <options>         Enable DNS mode with the given domain.
   domain=<domain>       The domain to make requests for.
   host=<hostname>       The host to listen on (default: 0.0.0.0).
   port=<port>           The port to listen on (default: 53).
   type=<type>           The type of DNS requests to use, can use
                         multiple comma-separated (options: TXT, MX,
                         CNAME, A, AAAA) (default: TXT,CNAME,MX).
   server=<server>       The upstream server for making DNS requests
                         (default: autodetected = 127.0.1.1).

So something like, --dns="domain=domain.com,host=8.8.8.8,port=53,type=cname"

On Thu, Mar 23, 2017 at 1:03 PM, slohin-st [email protected] wrote:

I am also very interested in the solution. If it is the MX response, is there any way to tell DNScat to not use MX responses? For example, when the DNS driver gets created it shows "type = TXT, CNAME, MX". Is there a flag that tells it to use just CNAME?

dnscat2 is great, by the way. Thanks for sharing! 💃

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iagox86/dnscat2/issues/95#issuecomment-288843390, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgITGFGDytxbpz-w9A1MexQPsDnnEHFks5rotAOgaJpZM4IgYlc .

iagox86 avatar Mar 23 '17 22:03 iagox86

Thanks! I did figure it out, thanks! Do you think it may have something to do with the size of records? I believe that the TXT record allows a larger payload, so maybe Windows DNS doesn't agree with the string that is being inserted into the subdomain for MX and CNAME records?

slohin-st avatar Mar 23 '17 23:03 slohin-st

Hello, having same issue, tryed A, TXT MX and CNAME all does fail, got a cb session that is unresponsive. ./dnscat --secret=4f9f64d1518407f54a322ff13fe05254 --dns="domain=xxx,type=MX"

DNS server returned an unknown character in the string: 0xc1 Unrecoverable error in libs/dns.c(92): Couldn't process string Creating DNS driver: domain = xxxx host = 0.0.0.0 port = 53 type = MX server = 10.0.0.2 Aborted

updated:legacy dnscat seems to have same type of issue Starting DNS requests to domain 'xxxx' xxxx:53... Creating new session exejatnr with sequence number 67416268 Attempting to start process '/bin/bash' for session exejatnr Started: /bin/bash (pid: 26998) DNS server returned an unknown character in the string: 0xc1 Unrecoverable error in dns.c(91): Couldn't process string

just after i type ls -al it starts to give output but crashes.

Please suggest the solution I am going crazy here :)

BenMoore71 avatar Mar 04 '18 17:03 BenMoore71

I got this error. Anyone knows exaclty why this happens ?

ovcrash avatar May 18 '22 23:05 ovcrash