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

sql escaping in sqlite(3) backend failed #358

Closed
Habbie opened this issue Apr 26, 2013 · 3 comments
Closed

sql escaping in sqlite(3) backend failed #358

Habbie opened this issue Apr 26, 2013 · 3 comments
Assignees
Labels

Comments

@Habbie
Copy link
Member

Habbie commented Apr 26, 2013

Hi,

I just discovered a bug in the sqlite3 backend which leads to a SQL injection vulnerability.

I'm running a master nameserver and a slave which get's updated by axfr. I have a "<script>alert('xss')</script>" TXT-Record (for a POC of triggering XSS on website) and got this in the slaves log file:

May 4 13:03:22 deimos pdns[6192]: Communicator thread died because of error: Unable to compile SQLite statement : near "test": syntax error

Seems the content of the record does not get escaped properly.

Steps to reproduce:

  • Given you have a master and a slave nameserver.
  • Add a record with a ' (for example a TXT record) on the master nameserver.
  • Start a zone transfer

I haven't yet tried to trigger it via a crafted DNS query, in that case the impact would be much bigger..

@ghost ghost assigned Habbie Apr 26, 2013
@Habbie Habbie closed this as completed Apr 26, 2013
@Habbie
Copy link
Member Author

Habbie commented Apr 26, 2013

Author: anon
A simple query isn't enough to trigger it, because it gets filtered as invalid before reaching the gsqlite3 backend:

May 4 15:25:10 phobos pdns[24178]: Received a malformed qdomain from 85.214.243.247, 'foo'bar.freigeist.org': sending servfail

Johannes 'fish' Ziemke

@Habbie
Copy link
Member Author

Habbie commented Apr 26, 2013

Author: anon
btw: I'm running pdns from debian, package version: 2.9.22-8

-- Johannes 'fish' Ziemke

@Habbie
Copy link
Member Author

Habbie commented Apr 26, 2013

Author: anon
Just tried to reproduce it with a recent 3.0 snapshot and it's already fixed there (see changeset [1342])

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

No branches or pull requests

1 participant