ORM Leaking More Than You Joined For - elttam
Harbor's user-listing API passed a user-controlled filter expression straight into the Beego ORM, so an attacker could filter on sensitive fields such as password and salt. Successive deny-list patches were bypassed because Beego overwrites a non-relational field with the following field in an expression, and because Harbor mapped a fuzzy-match value to an operator itself.
elttam.com
Published on elttam.com
In this article, we expand on our previous Object Relational Mapper (ORM) Leak research and Black Hat EU briefing by showcasing an interesting expression‑parser bug in the Beego ORM that we used to bypass ORM Leak protections in Harbor. We also demonstrate an authentication‑bypass technique for the Prisma ORM that was…
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
Likely the application allowed user input to set both the field and the operator of a database filter without validating the whole expression against sensitive fields, and the ORM's expression parser silently replaced a non-relational field with the next field in the chain.
Impact
An attacker with enough permission to list users could filter on password and salt fields and infer their values; relational filtering was not available to low-privileged or unauthenticated users, and the fuzzy-match bypass lost case sensitivity on the salt field.
What the attacker needed
Permission to list users; Harbor using the Beego ORM
The fix
Harbor finally fixed it in v2.14.0 by checking the operator part of the filter expression against an allow list, and the Beego parsing issue remains unfixed.
How it was found
- Send a request to the user listing endpoint with a filter expression in the q parameter that names a sensitive field.
- Observe that the response reveals whether the filter matched, leaking information about the sensitive value.
- After the deny-list patch, prefix the sensitive field with a non-relational field so the parser overwrites it.
- After the separator-limit patch, use the fuzzy-match value format so the application itself appends the contains operator.
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.
An ORM is the layer a program uses to talk to its database. Here the program let a user choose which database column to search on, including secret columns like the password hash, and the answer (how many results came back) revealed information about those secrets. The fixes tried to block bad column names but the underlying library misread the crafted names, so the block could be stepped around.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.