Skip to content
Access control Write-up Intermediate

Auth Bypass in ADOdb CVE-2021-3850

The ADOdb library's input filtering for database connection strings could be bypassed by supplying a username or password that starts and ends with a single quote, allowing an attacker to inject additional connection parameters. This enabled bypassing phpPgAdmin's login checks and weak password filters, and could reveal the backend IP address of a server behind caching or DDoS protection.

Emmet Leah Follow

Published on blog.sorcery.ie

/posts/adodbauthbypass/ map(name:Sorcery Ltd)

Emmet Leah, on blog.sorcery.ie

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The filtering function returned the input unchanged if it started and ended with a single quote, assuming it was already safely quoted, which allowed injection into the connection string.

Impact

An attacker could bypass phpPgAdmin's login and weak password filters, and potentially reveal the backend IP address of a server behind caching or DDoS protection.

What the attacker needed

PhpPgAdmin using vulnerable ADOdb; attacker controls a Postgres server

The fix

The patch removed the line that skipped filtering for already-quoted input, so all input is now properly escaped.

How it was found

  1. Enter a username that starts and ends with a single quote and includes additional connection parameters, such as host='[redacted]'.
  2. The application passes this username to ADOdb's filtering function, which returns it unchanged because it starts and ends with a quote.
  3. The username is inserted into the Postgres connection string, adding the attacker-controlled host parameter.
  4. The application connects to the attacker's server instead of the legitimate database, allowing login bypass.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you log in to a web application, your username and password are often placed into a string that tells the program how to connect to a database. The library that builds this string had a flaw: if your input began and ended with a single quote, it skipped cleaning it. An attacker could use this to add extra instructions to the connection string, like telling the application to connect to a different database server, and thereby bypass login checks.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.