Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client does not validate DNS transaction id #30

Closed
daniel4x opened this issue Jan 8, 2022 · 2 comments
Closed

Client does not validate DNS transaction id #30

daniel4x opened this issue Jan 8, 2022 · 2 comments

Comments

@daniel4x
Copy link

daniel4x commented Jan 8, 2022

Hi,

dnslib client does not validate DNS transaction id (TXID) as specified in the RFC.
This considered as implementation bug. Attackers can use this to redirect users to their malicious name servers.
I know the client created for testing but other projects using dnslib as a dependency might be affected as well.

I suggest to add a simple validate:

#... request code
a_pkt = q.send(address,port,tcp=args.tcp)
a = DNSRecord.parse(a_pkt)

if q.header.id != a.header.id:
    raise DNSError('Response transaction id does not match query transaction id')
@carnil
Copy link

carnil commented Jan 9, 2022

This issue appears to have been assigned a CVE, CVE-2022-22846.

@paulc
Copy link
Owner

paulc commented Jan 9, 2022

Thanks - as you note client.py is for testing but should clearly check TXIDs. I've also added a note in the README to ensure that TXID is validated. I've updated and released a new version on PyPi.

The CVE seems a bit ridiculous - sounds like someone just generating random CVEs to look good on a resume (it isn't actually accurate as it is not a library function - dnslib just parses the packets)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants