I Audited the Fix for a CVE. It Had Another CVE Hiding Inside It | CVE-2026-89267 | Starlette-Admin
The fix for CVE-2026-54553 in starlette-admin introduced a new bug: when searchable_fields is set to an empty list, the validation function short-circuits and allows searching on any field. An authenticated user could then query sensitive fields that the developer intended to disable.
Published on medium.com
Cybersecurity
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.
Context
starlette-admin is an admin framework for FastAPI and Starlette applications, written in Python. It provides a full administrative interface, with list views, filters, forms and search, wired to your models with minimal boilerplate. The author describes it as the Django admin panel equivalent for the FastAPI world.
When you define a model view, you configure which fields appear in the list view, which ones a user can sort by, and which ones they can search or filter on. Two options matter here: sortable_fields and searchable_fields. Setting either to None means the framework defaults to allowing all fields. Setting either to an explicit list means only those fields are allowed. Setting either to an empty list, [], is the natural way to say "disable this entirely".

Setup
The researcher copied the two validation functions character for character from commit [redacted] into a harness. The researcher read the fix commit for an earlier CVE and copied the two validation functions character for character from commit [redacted] into a harness. The harness uses both functions copied character for character from commit af05b45. A model with an ssn field visible in the list view, sortable_fields = [], searchable_fields = []: VulnCheck published it as CVE-2026-89267, affecting versions 0.16.1 through 0.17.1.
Finding it
In August 2026 another researcher published CVE-2026-54553. starlette-admin before version 0.16.1 did not validate the field names supplied through the order_by and where parameters against the configured allowlists at all. An authenticated user could sort or filter by any field, including fields never meant to be exposed through search. The author calls this an "info-exposure oracle": you cannot read the values directly, but you can run equality and comparison queries against fields such as SSNs or internal notes, and by watching whether results come back you can extract those values one query at a time.
The maintainer fixed it in 0.16.1 across two commits, d2a25eb and af05b45. The second fix commit added two validation functions to views.py, _validate_order_by and _validate_where. They are meant to do parallel jobs: one checks whether a field name can be sorted by, the other whether it can be searched on. Their logic should be symmetric, and almost is. The check in _validate_where has one extra word that breaks it.
Exploitation
Step 1: Compare the two validation functions
Both functions are copied verbatim from commit [redacted], the final commit closing the original CVE:
def _validate_order_by(self, request, order_by): list_field_names = {f.name for f in self._all_fields if not f.exclude_from_list} sortable: Set[str] = set(self.sortable_fields or []) for clause in order_by: ... if field_name not in list_field_names or field_name not in sortable: return f"Unknown field or field is not sortable in order_by: '{field_name}'" return None
def _validate_where(self, request, where): list_field_names = {f.name for f in self._all_fields if not f.exclude_from_list} searchable = set(self.searchable_fields or []) for field_name in self._extract_fields_from_where(where): if field_name not in list_field_names or ( searchable and field_name not in searchable ): return f"Unknown field or field is not searchable in where: '{field_name}'" return None
The sortable check is field_name not in sortable. The searchable check is searchable and field_name not in searchable. The difference is the searchable and prefix.
Step 2: Show that the prefix short-circuits
In Python an empty set is falsy, so bool(set()) is False. If searchable_fields is configured as [], then searchable becomes set([]), an empty set, which is falsy. The expression searchable and field_name not in searchable short-circuits at searchable, and the right-hand side, the actual check, never runs. The entire searchable-fields restriction is silently skipped whenever a developer explicitly sets searchable_fields = [].
_validate_order_by does not have this problem. field_name not in sortable is evaluated regardless of whether sortable is empty. An empty set is still a valid set, and 'ssn' not in set() evaluates to True, which triggers the rejection correctly.
Step 3: Run the harness against both functions
With the model configured as described, the sortable path rejects the field:
Result: "Unknown field or field is not sortable in order_by: 'ssn'" Correctly rejected? True
The searchable path allows the same field:
--- _validate_where({'ssn': {'eq': '123-45-6789'}}) --- Result: None Correctly rejected? False
Same field, same "disable entirely" configuration on both. One function rejects it, the other allows it.
Step 4: Reduce the root cause to one line
>>> searchable = set([] or []) >>> searchableset()>>> bool(searchable)False>>> searchable and "ssn" not in searchableFalse
Step 5: Confirm the fix restores symmetry
Dropping the short-circuit makes the searchable path reject the field:
Result: "Unknown field or field is not searchable in where: 'ssn'" Correctly rejected? True
One word removed, and the behaviour matches _validate_order_by exactly.
Root cause
The bug is a falsy short-circuit in a parallel check. , but an explicit empty allowlist is falsy in Python, so the enforcement branch is skipped precisely in the configuration that most clearly asks for enforcement. The fix covered _validate_order_by correctly and added _validate_where at all, but the extra operator made the new function's behaviour wrong in one specific case.
Impact
This is the same impact class as the original CVE: an authenticated user with access to a list endpoint can query by fields the developer explicitly excluded from search. The difference is scope. The original CVE affected every deployment before 0.16.1. This one affects only deployments where a developer set searchable_fields = [] intending to lock down a sensitive model. VulnCheck rated it Medium rather than the original's higher impact.
Narrower is not zero. Any admin panel protecting sensitive columns with an explicit empty searchable allowlist, which the author argues is a realistic configuration rather than an edge case, is running with that protection silently disabled through 0.17.1.
Fix
The suggested fix is to remove searchable and from the condition, mirroring _validate_order_by's structure exactly:
if field_name not in list_field_names or ( searchable and field_name not in searchable):
# Fixed:if field_name not in list_field_names or field_name not in searchable:
If you run starlette-admin 0.16.1 through 0.17.1 with searchable_fields = [] on any model view that has sensitive fields, the protection you think you configured is not enforced. Upgrade to a fixed version when one is available, or patch the check manually in the interim.
Variants to test
- Look for the same falsy short-circuit pattern in other allowlist checks:
allowed and x not in allowed,fields and ...,if self.only and .... A positive result is an empty allowlist that permits a field the developer meant to block. - Compare sibling validation functions for symmetry. Where one function checks
x not in allowand its twin checksallow and x not in allow, test the twin with an empty allowlist. A positive result is a rejection from one path and acceptance from the other for the same field. - Test the three configurations of each allowlist option separately:
None, an explicit list, and[]. A positive result is[]behaving likeNonerather than like a deny-all. - Audit the fix commits for earlier CVEs in the same codebase, not just the advisories. A positive result is a newly added check that is correct in one code path and subtly wrong in another.
- Exercise the query parameters the fix was meant to guard, such as
order_byandwhere, against a model with a sensitive field visible in the list view. A positive result is a query on that field returning results instead of an "Unknown field" error.
What happened, in plain words
A security researcher read the patch that fixed an earlier security bug in a Python web tool called starlette-admin. While reading the patch, he noticed that the fix itself contained a new, smaller bug. The new bug meant that one particular way of locking down a model, which the earlier fix was supposed to protect, was silently ignored. He emailed the maintainer with the full report and got no response, then went to VulnCheck, which published it as CVE-2026-89267, affecting versions 0.16.1 through 0.17.1 of starlette-admin.
This article walks through the whole story from zero: what the product is, what the earlier bug was, what the fix looked like, where the one extra word sits, why Python treats that word the way it does, how the researcher proved the problem with a small test program, what the impact is, and what the fix is. No prior security knowledge is assumed.

The product: what starlette-admin is
starlette-admin is an add-on library for two Python web frameworks, FastAPI and Starlette. A web framework is a toolkit that helps programmers build websites and web services in a particular language; FastAPI and Starlette are popular choices in the Python world.
What starlette-admin gives you is an admin panel: a ready-made set of web pages where a trusted person (an administrator) can browse, search, filter and edit the records stored by the application. If you have ever used the back office of a shop website to look up orders, you have used something like this. The author compares it to Django's admin panel, which is the equivalent tool in another Python framework called Django.
When a programmer sets up an admin panel with starlette-admin, they describe their data as models. A model is just a description of one kind of record, for example a customer, with a list of fields: name, email, social security number, internal notes, and so on. For each model the programmer then configures a model view, which decides how that model appears in the admin panel: which fields show up in the list, which fields the administrator can sort by, and which fields the administrator can search or filter on.
Two configuration options matter for this story:
sortable_fields: which fields the administrator is allowed to sort the list by.searchable_fields: which fields the administrator is allowed to search or filter on.
Each of these can be set in three ways:
- Set it to
None(Python's way of saying "nothing here"). The framework then falls back to its default, which is to allow all fields. - Set it to an explicit list of field names. Only those fields are allowed.
- Set it to an empty list, written
[]. This is the natural way for a programmer to say "disable this entirely, allow nothing".
That third option is the heart of the story. Keep it in mind.
The earlier bug: CVE-2026-54553
In August 2026, a different researcher published a security report known as CVE-2026-54553. A CVE is a public identifier for a known security flaw, so that everyone can refer to the same bug by the same name. The flaw was in starlette-admin versions before 0.16.1.
To understand it, you need to know what a query parameter is. When you use a website, the address in your browser can carry extra pieces of information after a question mark, for example ?page=2. Those pieces are query parameters. The admin panel uses two of them for sorting and filtering: order_by (sort by this field) and where (filter where this field equals this value).
The bug was that starlette-admin did not check those field names against the configured allowlists at all. So an authenticated user could sort or filter by any field, including fields the programmer never intended to expose through search, such as a social security number.
The author calls this kind of bug an info-exposure oracle. An oracle, in the old sense, is something you ask a question and it gives you an answer. Here the attacker cannot simply read the secret value, but they can ask the server yes/no questions: "is the social security number equal to 123-45-6789?", "is it greater than 500-00-0000?" and so on. By watching whether results come back, they can work out the value one query at a time. It is like guessing a password by watching someone's face instead of reading it off a screen.
The maintainer (the person who maintains the library) fixed this in version 0.16.1, across two commits. A commit is a saved change in a code repository, the shared storage where programmers keep and track their code. The two commits were d2a25eb and af05b45. The researcher read the second one, af05b45, carefully.
The fix and the two functions
The fix added two validation functions to a file called views.py. A function is a named block of code that does one job and can be called by name. These two functions are meant to do parallel jobs:
_validate_order_bychecks whether a field name is allowed to be sorted by._validate_wherechecks whether a field name is allowed to be searched on.
Because they do parallel jobs, their logic should be symmetric: the same shape, just with the sortable list in one and the searchable list in the other. And it almost is. The check in _validate_where has one extra word that breaks it.
Step 1: Compare the two functions
Here are both functions, copied exactly from commit [redacted], the final commit that closed the original CVE:
def _validate_order_by(self, request, order_by): list_field_names = {f.name for f in self._all_fields if not f.exclude_from_list} sortable: Set[str] = set(self.sortable_fields or []) for clause in order_by: ... if field_name not in list_field_names or field_name not in sortable: return f"Unknown field or field is not sortable in order_by: '{field_name}'" return None
Line by line, in plain words:
def _validate_order_by(self, request, order_by):starts the definition of the function. It receives the request and the list of requested sort clauses.list_field_names = {f.name for f in self._all_fields if not f.exclude_from_list}builds a set of the names of all fields that are actually shown in the list view. A set is a collection with no duplicates, like a bag of unique labels.sortable: Set[str] = set(self.sortable_fields or [])turns the configuredsortable_fieldsinto a set. Theor []part means: ifsortable_fieldsisNone, use an empty list instead.for clause in order_by:goes through each requested sort clause one at a time....stands for code the author left out of the excerpt.if field_name not in list_field_names or field_name not in sortable:is the actual check. It rejects the field if it is not in the list view, or if it is not in the sortable allowlist.return f"Unknown field or field is not sortable in order_by: '{field_name}'"returns an error message naming the field.return Noneat the end means: no error, the request is fine.
Now the second function:
def _validate_where(self, request, where): list_field_names = {f.name for f in self._all_fields if not f.exclude_from_list} searchable = set(self.searchable_fields or []) for field_name in self._extract_fields_from_where(where): if field_name not in list_field_names or ( searchable and field_name not in searchable ): return f"Unknown field or field is not searchable in where: '{field_name}'" return None
Line by line:
def _validate_where(self, request, where):starts the definition of the second function, which receives the filter expression.list_field_names = {f.name for f in self._all_fields if not f.exclude_from_list}is the same as before: the fields shown in the list view.searchable = set(self.searchable_fields or [])turns the configuredsearchable_fieldsinto a set, again falling back to an empty list if it isNone.for field_name in self._extract_fields_from_where(where):pulls out each field name mentioned in the filter and loops over them.if field_name not in list_field_names or (starts the check. Theormeans: reject if the field is not in the list view, or if the second part is true.searchable and field_name not in searchableis the second part. This is where the extra word lives.):closes the condition.return f"Unknown field or field is not searchable in where: '{field_name}'"returns the error message.return Nonemeans: no error.
The sortable check is field_name not in sortable. The searchable check is searchable and field_name not in searchable. The difference is the searchable and prefix. That is the whole bug.
Step 2: Show that the prefix short-circuits
In Python, an empty set counts as falsy, which means it behaves like False when used in a condition. So bool(set()) is False. If searchable_fields is configured as [], then searchable becomes set([]), an empty set, which is falsy.
The expression searchable and field_name not in searchable uses a feature called short-circuit evaluation. In Python, A and B first looks at A. If A is falsy, the whole expression is already known to be falsy, so Python does not bother looking at B at all. It stops right there. That is the short circuit.
So when searchable is an empty set, the expression short-circuits at searchable, and the right-hand side, the actual check, never runs. The whole searchable-fields restriction is silently skipped whenever a programmer explicitly sets searchable_fields = [].
_validate_order_by does not have this problem. field_name not in sortable is evaluated regardless of whether sortable is empty. An empty set is still a valid set, and 'ssn' not in set() evaluates to True, which triggers the rejection correctly. The extra searchable and prefix in _validate_where is the only reason the behaviour diverges.
Step 3: Run the harness against both functions
A harness is a small test program built to exercise a piece of code in isolation. The researcher copied both functions character for character from commit af05b45 into a harness. A model with an ssn field visible in the list view, sortable_fields = [], searchable_fields = []: In other words: "show the SSN in the list, but allow nobody to sort by it and nobody to search on it."
With that model, the sortable path rejects the field:
Result: "Unknown field or field is not sortable in order_by: 'ssn'" Correctly rejected? True
What this output says: when the harness asked _validate_order_by about the ssn field, the function returned the error message "Unknown field or field is not sortable in order_by: 'ssn'", and the harness marked it as correctly rejected. That is the behaviour we want.
The searchable path allows the same field:
--- _validate_where({'ssn': {'eq': '123-45-6789'}}) --- Result: None Correctly rejected? False
What this output says: the harness called _validate_where with a filter asking for records where ssn equals 123-45-6789. The function returned None, meaning "no error, go ahead", and the harness marked it as not correctly rejected. Same field, same "disable entirely" configuration on both. One function rejects it, the other allows it. The asymmetry is right there in the output.
Step 4: Reduce the root cause to one line
To make the cause crystal clear, the researcher reduced it to a few lines typed into a Python prompt (the >>> is the prompt symbol):
>>> searchable = set([] or []) >>> searchableset()>>> bool(searchable)False>>> searchable and "ssn" not in searchableFalse
Line by line:
>>> searchable = set([] or [])creates the same empty set the function would create whensearchable_fields = [].>>> searchablefollowed byset()shows that the value is an empty set.>>> bool(searchable)followed byFalseshows that Python considers that empty set falsy.>>> searchable and "ssn" not in searchablefollowed byFalseshows the short circuit in action: because the left side is falsy, the whole expression isFalse, and the check on"ssn"never runs.
Step 5: Confirm the fix restores symmetry
Dropping the short-circuit makes the searchable path reject the field:
Result: "Unknown field or field is not searchable in where: 'ssn'" Correctly rejected? True
What this output says: after the fix, _validate_where returns the error message "Unknown field or field is not searchable in where: 'ssn'", and the harness marks it as correctly rejected. One word removed, and the behaviour matches _validate_order_by exactly.
Root cause
The bug is a falsy short-circuit in a hand-written parallel check. But an explicit empty allowlist is falsy in Python, so the enforcement branch is skipped precisely in the configuration that most clearly asks for enforcement. The existing defence, the allowlist validation added by the previous CVE's fix, was present and correct in _validate_order_by; it failed only in _validate_where, and only for the empty-list configuration.
Impact
This is the same impact class as the original CVE: an authenticated user with access to a list endpoint can query by fields the programmer explicitly excluded from search. Authenticated means the person has logged in; a list endpoint is the web address the admin panel uses to fetch the list of records.
The difference is scope. The original CVE affected every deployment before 0.16.1. This one affects only deployments where a programmer set searchable_fields = [] intending to lock down a sensitive model. VulnCheck, the organisation that published the advisory, rated it Medium rather than the original's higher impact. A severity rating is a rough label (Low, Medium, High, Critical) for how serious a bug is.
Narrower is not zero. Any admin panel protecting sensitive columns with an explicit empty searchable allowlist, which the author argues is a realistic configuration rather than an edge case, is running with that protection silently disabled through 0.17.1.
Fix
The suggested fix is to remove searchable and from the condition, mirroring _validate_order_by's structure exactly:
if field_name not in list_field_names or ( searchable and field_name not in searchable):
This is the vulnerable line as it stands. It says: reject the field if it is not in the list view, or if an allowlist is configured and the field is not in it. The second half is the part that fails when the allowlist is empty.
# Fixed:if field_name not in list_field_names or field_name not in searchable:
This is the fixed line. It says: reject the field if it is not in the list view, or if it is not in the searchable allowlist. Now an empty allowlist means "nothing is allowed", which is what the programmer intended.
If you run starlette-admin 0.16.1 through 0.17.1 with searchable_fields = [] on any model view that has sensitive fields, the protection you think you configured is not enforced. Upgrade to a fixed version when one is available, or patch the check manually in the interim.
Variants to test
If you want to look for similar bugs yourself, here are five things to try. Each one is a pattern to look for, not a promise that a bug is there.
- Look for the same falsy short-circuit pattern in other allowlist checks:
allowed and x not in allowed,fields and ...,if self.only and .... A positive result is an empty allowlist that permits a field the programmer meant to block. - Compare sibling validation functions for symmetry. Where one function checks
x not in allowand its twin checksallow and x not in allow, test the twin with an empty allowlist. A positive result is a rejection from one path and acceptance from the other for the same field. - Test the three configurations of each allowlist option separately:
None, an explicit list, and[]. A positive result is[]behaving likeNonerather than like a deny-all. - Audit the fix commits for earlier CVEs in the same codebase, not just the advisories. A positive result is a newly added check that is correct in one code path and subtly wrong in another.
- Exercise the query parameters the fix was meant to guard, such as
order_byandwhere, against a model with a sensitive field visible in the list view. A positive result is a query on that field returning results instead of an "Unknown field" error.
Why reading fixes is worth doing
Most people read CVE write-ups when they come out and move on. The author has started reading the fix commits too, specifically because the fix is where the interesting part often happens. A programmer who just fixed a bug wrote that fix quickly, under some time pressure, possibly without a comprehensive view of every similar pattern in the codebase. The question worth asking after every fix is: did this solve the whole problem, or just the visible part of it?
In this case, the fix was careful enough to cover _validate_order_by correctly and careful enough to add _validate_where at all. It just introduced one extra operator that made the new function's behaviour wrong in one specific case. That is not carelessness; it is the kind of mistake that happens when you are writing parallel logic by hand. It is also exactly the kind of thing that shows up when you slow down and read the diff. A diff is the side-by-side view of what changed between two versions of a file.
Glossary
- Admin panel: a set of web pages where a trusted person can browse, search and edit the records stored by an application.
- Allowlist: a list of things that are permitted; anything not on the list is refused.
- Authenticated: having proved who you are, usually by logging in.
- Commit: a saved change in a code repository, with an identifier such as
af05b45. - CVE: a public identifier for a known security flaw, so everyone can refer to the same bug by the same name.
- Deployment: a running installation of a piece of software on a real server.
- Diff: the side-by-side view of what changed between two versions of a file.
- Endpoint: a specific web address that an application responds to, such as the one that returns a list of records.
- Falsy: a value that Python treats like
Falsein a condition; an empty set, an empty list andNoneare all falsy. - FastAPI / Starlette: two Python web frameworks, toolkits for building web services.
- Field: one named piece of data in a record, such as a name or a social security number.
- Function: a named block of code that does one job and can be called by name.
- Harness: a small test program built to exercise a piece of code in isolation.
- Info-exposure oracle: a bug where an attacker cannot read a secret directly but can ask the server yes/no questions about it and infer the value from the answers.
- Maintainer: the person who maintains a software project.
- Model: a description of one kind of record in an application, with a list of fields.
- Model view: the configuration that decides how a model appears in the admin panel.
- Query parameter: an extra piece of information in a web address, after the question mark, such as
?page=2. - Set: a collection with no duplicates, like a bag of unique labels.
- Severity rating: a rough label (Low, Medium, High, Critical) for how serious a bug is.
- Short-circuit evaluation: the rule that
A and Bstops atAifAis falsy, without looking atB. - Symmetric: having the same shape or logic, just applied to different things.
- VulnCheck: the organisation that published the advisory for this CVE.