Join our Newsletter — 33% off our NHI Course
Home› Glossary› Threats, Abuse & Incident Response› Authorization Bypass Through User-Controlled SQL Primary…
Threats, Abuse & Incident Response

Authorization Bypass Through User-Controlled SQL Primary Key

← Back to Glossary
By NHI Mgmt Group Updated October 17, 2026 Domain: Threats, Abuse & Incident Response

Authorization Bypass Through User-Controlled SQL Primary Key is a flaw where an application uses a primary key supplied by the user to fetch or change records without checking whether that user is allowed to access them. Attackers can swap the key to reach other users’ data. Defenders enforce server-side object-level authorisation and avoid trusting client-controlled record identifiers.

How This Flaw Works

This weakness appears when an application treats a user-supplied primary key as proof of authority. If the server uses that identifier to load or update a record without checking ownership or access rights, an attacker can swap the key and reach another user’s object.

The issue is not the database primary key itself, but the trust boundary around it. A record identifier can be stable, predictable, or easy to guess, which makes it a poor substitute for server-side object-level authorisation.

Why It Becomes an Authorization Problem

At a technical level, the flaw is a form of object-level access control failure. The application may authenticate the user correctly, yet still allow that user to act on records they do not own because the record lookup happens before the authorisation decision.

This is why defences focus on the server, not the client. The application must verify that the current subject is allowed to access the specific object, rather than assuming that a presented identifier is legitimate. Authorisation Models Guide is useful background when teams need to compare policy patterns for enforcing that decision.

Where applications expose records through APIs, the same weakness often shows up as broken object-level authorisation. The control failure is identical: the request reaches a valid object, but the application does not bind access to the right subject and resource combination.

Where Attackers Abuse It

Attackers usually look for predictable identifiers in URLs, JSON payloads, forms, GraphQL variables, or hidden fields. Once one valid key is known, they test adjacent values or replace the object reference in a request to see whether the application returns data or performs the requested change.

Because the request is otherwise well-formed, simple authentication checks, session validation, and perimeter controls may all succeed. That makes the flaw especially useful for horizontal privilege escalation, data theft, and unwanted record modification.

In API-heavy systems, this pattern is often easier to exploit than traditional injection flaws because the attacker does not need to break the transport or the database, only the authorisation logic surrounding the object reference.

What Defenders Should Enforce

Design the application so the server derives the accessible object set from the user’s permissions, not from a raw client-supplied key. When practical, expose opaque references, but treat them as usability aids, not as security controls.

Every fetch, update, delete, and export path should perform an object-level check against the caller’s rights. That includes secondary code paths such as bulk actions, search endpoints, background jobs, and administrative views. For a broader control lens, IAM and IGA Basics helps place object checks inside the wider access-governance model.

Defenders should also review how identifiers are exposed across different layers, because a secure front end can still be undermined by a weaker API or service endpoint. The safest pattern is consistent server-side mediation of object access everywhere the record can be reached.

Risk and Threat Considerations

This flaw can expose sensitive records at scale when object identifiers are enumerable, reused, or exposed across multiple interfaces. It often creates quiet data loss because requests look legitimate, which makes detection harder than with obvious exploitation attempts.

Failure mechanism: The application accepts a user-controlled primary key and fails to bind the request to the caller’s permissions before returning or changing the object.

Impact: Attackers can read, modify, or delete other users’ records, leading to confidentiality breaches, integrity loss, and possible account or workflow abuse.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack surface, NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, and ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
OWASP API Security Top 10API1 — Broken Object Level AuthorizationDirectly covers user-controlled object references and missing object checks.
Recommendation — Enforce object-level checks on every request before returning or mutating a record.
NIST SP 800-53 Rev 5AC-3 — Access EnforcementDefines enforcing approved authorisations for specific objects and actions.
IA-2 — Identification and Authentication (Organizational Users)Authentication alone is insufficient, but it underpins the actor whose rights are checked.
Recommendation — Apply access enforcement at the service layer for each object lookup and change. Require authenticated identity before evaluating object-specific permissions.
CIS Controls v8CIS-6 — Access Control ManagementCovers controlling and reviewing access paths that can expose object-level abuse.
Recommendation — Review and restrict access paths so sensitive objects are only reachable by approved users.
ISO/IEC 27001:2022A.5.15 — Access controlRequires access rules that limit who can reach or modify protected information and objects.
Recommendation — Define and enforce access rules for each protected object and service path.

Practitioner Guidance

What to watch for: Investigate any endpoint that accepts a record identifier from the client and returns data without a clearly defined ownership or entitlement check. Pay particular attention to update and export functions, because they often have the highest blast radius.

Governance implication: Treat object-level authorisation as a required design property, not a late-stage code review item. Teams should be able to explain, for each sensitive object, who may access it and where that decision is enforced in the request path.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 17, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org