KHAGAN AYDIN

OWASP 2013 A7: Missing Function Level Access Control

Hiding the admin button is decoration. The request still goes through.

· 10 min read

Missing Function Level Access Control is a security vulnerability in which the server performs a privileged action without checking that the user who asked is allowed to perform it. It is number seven on the 2013 OWASP Top 10. It was called Failure to Restrict URL Access in the 2010 list, and the rename is the whole lesson: the problem was never about URLs. It is about functions a user is allowed to reach but not allowed to call, where the only thing stopping them is that the interface did not show them the way in.

The interface is not a security control. It runs in the attacker’s browser, on the attacker’s phone, under the attacker’s complete control. If the server performs a privileged action because a request arrived, and never checks whether this particular user is allowed to perform it, then the lock is a drawing of a lock. Someone will try the handle.

What the bug is, in plain words

Every application has functions that only some users should call: delete a user, change a price, approve a refund, export the customer list, read another person’s messages. Access control is the server asking, for each such function, is the person making this request allowed to make it.

The bug is skipping that question. The developer hid the admin link from normal users, and reasoned that if they cannot see it they cannot use it. But the link is just a signpost. The function sits at a known address, and the request that triggers it can be sent by anyone, with or without the signpost. The failure is server-side: the handler runs the privileged code without ever confirming the caller’s privileges.

This is close kin to a related item on the same list, Insecure Direct Object References (IDOR), and people mix them up. The difference is clean. IDOR is reaching another instance of the same kind of thing: your invoice, their invoice, same function, wrong owner. Missing Function Level Access Control is reaching a function your role should never call at all: a normal user invoking an administrator’s delete. One is the wrong row; the other is the wrong verb.

How the attack works, step by step

An attacker does not need the hidden link. They watch what the application does for a privileged user, or they guess, and then they send the request themselves. The technique has an old name: forced browsing.

Start as a normal logged-in user. The account menu shows ordinary options. But the attacker knows admin panels tend to live at predictable addresses, so they ask for them directly:

GET /admin
GET /admin/users
GET /admin/users/42/delete
GET /api/v1/users/42
DELETE /api/v1/users/42

If any of these runs, the control was missing. No clever payload, just a request for a thing the menu did not offer.

The subtle variants are where real systems fail.

The check is in the page, not the handler. A site hides the admin area by not rendering its links for normal users, and maybe by hiding the admin dashboard page behind a role check. But the individual actions, the endpoints the dashboard’s buttons call, have no check of their own. The attacker never loads the dashboard. They call the action directly.

The verb trick. A framework or a declarative rule protects one HTTP method and not another. If the configured rule says “require the admin role for GET and POST on /admin/*,” then a request using a method not in that list may slip past the rule entirely and still reach the same code. In the Java servlet world this is exact and dangerous: a security constraint that lists specific methods only covers those methods, so a HEAD request, or even a made-up verb like FOO, is “uncovered” and passes through unchecked, while the container often still routes it to the GET logic. The guard checked the methods it was told about; the attacker used one it was not.

The mobile app that trusts itself. A mobile application shows an admin screen only to staff accounts, and the developers treat that as the control. But the app talks to the same API as everyone, and the API decides nothing. Pull the app’s traffic through a proxy, replay the admin call from a normal account, and it works, because the only thing that ever checked the role was a screen on the phone.

Real cases

A telecom mobile app API, January 2015. A researcher analyzing a large internet provider’s Android app found that its back-end API accepted a user identifier parameter and returned that account’s data, including the ability to read and send that user’s email. Logged in as yourself, you changed the identifier to someone else’s and the API complied. Almost five million accounts were reachable this way. It was reported and fixed within days. The root cause: the server trusted a value from the client to decide whose data to act on, and never confirmed the logged-in user was allowed to act on that account. The admin-style function, operate on any account, was exposed to every account because the check lived in the app, not the API. (This is the function-level cousin of IDOR: the endpoint itself should have been restricted and was not.)

The Magento shopping platform, April 2015. A security firm published its analysis of a chain of flaws in this widely used online store software. Magento checked for an admin session in one central step before any admin screen ran, and when there was none it swapped in the login page instead of ending the request. That step also stood aside for requests carrying a parameter meant only for the platform’s internal hand-offs between its own controllers, and nothing stopped an outsider from adding that parameter to a request. On its own, the bypass reached only the few admin screens that had no permission check of their own. One of them had a SQL injection flaw, and together they let a stranger write straight into the store’s database: add an administrator, or go further and run code on the server. The firm put the exposure at nearly 200,000 shops. The patch had shipped on February 9, but once the details were public, attacks that quietly added admin accounts began within a day against the many stores that had not applied it. The root cause: one central gate that a request could talk its way past, and admin screens that relied on that gate instead of checking permission for themselves.

Across both, the shape repeats: the server ran a privileged action for whoever asked, without ever confirming that the caller was entitled to it.

Vulnerable and fixed code

The fix is the same idea in every language: the server decides, by default no, and it decides on every privileged function, not on the page that links to it.

Java, Spring Security. Vulnerable

// Only the dashboard path is guarded. The actions it calls are wide open.
http
  .authorizeRequests()
    .antMatchers("/admin/dashboard").hasRole("ADMIN")
    .anyRequest().authenticated();

A normal user cannot load /admin/dashboard, but POST /admin/users/42/delete was never named, so anyRequest().authenticated() lets any logged-in user call it.

Fixed

// Guard the whole admin tree, for every method, and deny by default.
http
  .authorizeRequests()
    .antMatchers("/admin/**").hasRole("ADMIN")
    .anyRequest().authenticated();

Note /admin/** covers the actions, not just the landing page, and a Spring antMatchers rule with no HTTP method restriction applies to all methods, which closes the verb trick. For defense in depth, also annotate the handler itself, so the rule travels with the code even if someone rewrites the URL map:

@PreAuthorize("hasRole('ADMIN')")
public void deleteUser(long id) { ... }

Java, plain servlet with web.xml. The verb-trick fix lives here. A constraint that lists methods only covers those methods:

<!-- Vulnerable: only GET and POST on /admin/* are protected.
     A HEAD or an unknown verb is uncovered and slips through. -->
<security-constraint>
  <web-resource-collection>
    <web-resource-name>admin</web-resource-name>
    <url-pattern>/admin/*</url-pattern>
    <http-method>GET</http-method>
    <http-method>POST</http-method>
  </web-resource-collection>
  <auth-constraint><role-name>admin</role-name></auth-constraint>
</security-constraint>

Fixed: list no methods, so the constraint covers all of them, and in Servlet 3.1 (shipped 2013) add the flag that denies any uncovered method outright:

<deny-uncovered-http-methods/>
<security-constraint>
  <web-resource-collection>
    <web-resource-name>admin</web-resource-name>
    <url-pattern>/admin/*</url-pattern>
  </web-resource-collection>
  <auth-constraint><role-name>admin</role-name></auth-constraint>
</security-constraint>

PHP. Vulnerable

<?php
// deleteUser.php: reachable by anyone who knows the name
$db->prepare('DELETE FROM users WHERE id = ?')->execute([$_POST['id']]);

Fixed: check the role on the server, in the handler, before the action, and send an authenticated non-admin away:

<?php
session_start();
if (empty($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
    http_response_code(403);
    exit;
}
$db->prepare('DELETE FROM users WHERE id = ?')->execute([$_POST['id']]);

Better still, do not scatter that check across every file. Route privileged actions through one guard that runs first:

<?php
function require_role($needed) {
    if (empty($_SESSION['role']) || $_SESSION['role'] !== $needed) {
        http_response_code(403);
        exit;
    }
}
// at the top of every admin action:
require_role('admin');

ASP.NET MVC. The common finding is a controller that forgot its attribute:

// Vulnerable: no [Authorize], so anonymous users can POST here.
public class AdminController : Controller {
    [HttpPost]
    public ActionResult DeleteUser(int id) { /* deletes */ return View(); }
}

Decorating each controller works until someone adds a new one and forgets. Make authentication the default for the whole application and opt specific actions out instead:

// Global filter: every action requires a logged-in user by default.
public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
    filters.Add(new AuthorizeAttribute());
}

// A controller that needs a role states it; it does not rely on being hidden.
[Authorize(Roles = "Admin")]
public class AdminController : Controller {
    [HttpPost]
    public ActionResult DeleteUser(int id) { /* deletes */ return View(); }
}

// Only the genuinely public actions opt out, one by one.
[AllowAnonymous]
public ActionResult Login() { return View(); }

A plain [Authorize] carries no method restriction, so it covers GET, POST and every other verb that reaches the action, which is what you want.

Why the usual fixes fail

Hiding the link. The whole bug. The menu is cosmetics. If removing the link were security, you would not need a server.

An unguessable address. Moving the admin panel to /x7f3q/manage buys time, not safety. The address leaks: in a referrer header, a log, a cached page, a staff member’s browser history, a search engine that crawled it once. Obscurity is a delay, counted in weeks, not a control.

Checking at login and never again. Confirming the role when the session starts does nothing for a request sent later to a function the role should not reach. Authorization is per function, on every call, not a wristband you get at the door.

Guarding the page but not its actions. The trap that catches careful teams. The dashboard is behind a role check; the endpoints its buttons fire are not, because the developer pictured them being reached only through the dashboard. The attacker reaches them directly.

A rule tied to one HTTP method. The verb trick. A guard on GET and POST is not a guard, because the request can arrive by another method and often runs anyway.

Test your own application

This is one of the most testable items on the list, because you can check it with two accounts and a proxy.

Make two logins: one administrator, one ordinary user. As the admin, click through every privileged function with a proxy such as Burp Suite recording every request. You now have the exact list of privileged calls, addresses, methods and parameters.

Then replay each of those requests with the ordinary user’s session, changing nothing but the credentials. Every one that succeeds is a missing function level access control. This replay is the single most effective test for this whole category, and most teams never run it.

Next, log out entirely and replay the same requests with no session at all, to find functions that skip authentication outright.

Then try the variants. Resend a protected request with a different HTTP method: swap POST for GET, try HEAD, try a nonsense verb, and watch whether the action still happens. Walk predictable addresses by hand: /admin, /api/, /debug, /actuator, sequential endpoint names. For a mobile or single-page app, do all of this against the API directly, because that is the only layer that counts; the screen that hid the button is not in the request path.

Write down the rule as you go: for each privileged function, who is allowed, and where on the server that is enforced. If the answer for any function is “the interface does not show it,” you have found the bug.

The point

Missing Function Level Access Control is a failure of default. The application was built to say yes and to hide the things it should have said no to, when it should have been built to say no and to permit the few things each role may do. Deny by default, enforce on the server, check every privileged function on every call regardless of method, and treat the mobile app and the single-page front end as hostile clients that decide nothing. Then prove it the only way that counts: take a low-privilege account and try every privileged request yourself. The interface can keep hiding the button. Just make sure that when someone presses where the button used to be, the server says no.

Checklist

  • Deny by default. Authentication and the right role required unless a function is deliberately public.
  • Enforce access control on the server, in the handler, not in the interface.
  • Check every privileged function on every request, not once at login.
  • Guard the actions, not just the page that links to them.
  • Make rules cover all HTTP methods; never protect only GET and POST.
  • Treat mobile and single-page app APIs as the real boundary; the client decides nothing.
  • Do not rely on secret or unguessable addresses.
  • Test by replaying every admin request with a low-privilege account and with no account.