Secure development

Implementing consistent server-side authorisation checks

Access decision: person, gate, database arranged to illustrate implementing consistent server-side authorisation checks.

Implementing consistent server-side authorisation checks connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding consistent server-side authorisation checks helps establish which security property the feature needs and where that property is actually enforced.

What does this involve?

Authorisation determines which resources and operations an established identity may use. It must be enforced where protected data is read or changed. User interface restrictions, obscure identifiers and documentation can help usability, but they do not replace the service's own permission decision.

Authorisation may be defined as "the process of verifying that a requested action or service is approved for a specific entity" (NIST). Authorisation is distinct from authentication which is the process of verifying an entity's identity. When designing and developing a software solution, it is important to keep these distinctions in mind. A user who has been authenticated (perhaps by providing a username and password) is often not authorised to access every resource and perform every action that is technically possible through a system. For example, a web app may have both regular users and admins, with the admins being able to perform actions the average user is not privileged to perform, even though they have been authenticated. Additionally, authentication is not always required for accessing resources; an unauthenticated user may be authorised to access certain public resources, such as an image or login page, or even an entire web app.

Why it matters

Consider a realistic failure: a user can call a protected operation directly even though the frontend hides its control.

A missing check can expose another account's information or let an ordinary user perform a privileged action. The result should be described by the actual records and operations reached, including whether access crosses a customer or organisational boundary.

Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.

How penetration testers check for it

Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.

  • Compare users with different roles and ownership relationships.
  • Exercise read, change, delete and alternate access paths.
  • Test nested resources, background processing and state changes.
  • Confirm rejection as well as the legitimate successful journey.

How to fix it

Use the appropriate maintained mechanisms and verify the result in the actual production configuration.

  • Create tests that validate that the permissions mapped out in the design phase are being correctly enforced.
  • After the app has been deployed, periodically review permissions in the system for "privilege creep"; that is, ensure the privileges of users in the current environment do not exceed those defined during the design phase (plus or minus any formally approved changes).
  • Remember, it is easier to grant users additional permissions rather than to take away some they previously enjoyed. Careful planning and implementation of Least Privileges early in the SDLC can help reduce the risk of needing to revoke permissions that are later deemed overly broad.
  • Adopt a "deny-by-default" mentality both during initial development and whenever new functionality or resources are exposed by the app. One should be able to explicitly justify why a specific permission was granted to a particular user or group rather than assuming access to be the default position.
  • Enforce permission checks at each protected operation.
  • Maintain regression cases for unauthorised users and changed permissions.

A successful response alone does not prove unauthorised access. Establish whose resource was affected and what the caller was legitimately entitled to do.

Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.

Read about our methodology or contact pentested.com to discuss secure development and code review.

See your first test report this week.

Book a 30 minute demo. We will verify one of your targets with you and run a test against it, so you can judge the results on your own systems.

Book a demo