HTTP Method Override Accepted

The API honours headers or parameters that change the HTTP method of a request, so controls applied to the method as sent, by a proxy, firewall or the application, can be bypassed.

SeverityMedium
CVSS 3.14.3 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N Open in the calculator
CVSS 4.05.3 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-436: Interpretation Conflict
OWASP Top 10A06:2025 Insecure Design
MITRE ATT&CKT1190 Exploit Public-Facing Application
CategorySecurity Misconfiguration

Description

Some frameworks let a client send a request with one HTTP method and have it processed as another, by setting a header such as X-HTTP-Method-Override, X-HTTP-Method or X-Method-Override, or a parameter such as _method. The feature exists for clients that can send only GET and POST, such as HTML forms. Examples are the method override middleware in Express and ASP.NET Core, Rack::MethodOverride used by Ruby on Rails, the _method form field in Symfony and Laravel, and Spring's HiddenHttpMethodFilter.

The weakness arises when other components make decisions on the method as sent rather than the method the application acts on. A web application firewall, API gateway or reverse proxy that blocks DELETE or PUT, or applies different authentication or rate limits to them, sees only a POST. An authenticated user, or in some configurations an unauthenticated one, can therefore perform operations that a front-end control was meant to block, such as deleting or replacing resources through an API gateway that allows only reads, or can avoid authentication, logging or rate limits applied to specific methods.

Access rules in the application that are keyed on the method may be evaluated before the override is applied. An implementation that honours the override on GET requests can also make state-changing operations reachable from links and cross-site requests, exposing them to cross-site request forgery. The impact depends on the operations reachable this way and on which controls rely on the method; where no control depends on it, the feature adds little risk.

The weakness is identified by sending POST and GET requests carrying each override header or parameter with the value PUT, PATCH or DELETE, and observing whether the application performs the overridden action, particularly where the same method sent directly is blocked or treated differently.

Remediation

Disable method overriding where it is not needed, and make sure every control sees the effective method where it is:

  • Remove the override middleware or filter from APIs that do not serve HTML forms, for example by not calling app.UseHttpMethodOverride() in ASP.NET Core, removing the method-override middleware in Express, or leaving HiddenHttpMethodFilter disabled in Spring.
  • Where overriding is needed, accept it only on POST requests, only for the methods the application uses, and only in the one form the client needs, never on GET.
  • Apply authorisation in the application to the effective method, after the override has been resolved, rather than relying on method rules in front of it.
  • Strip override headers at the gateway or reverse proxy for routes that should not use them, or configure the gateway to evaluate the overridden method.
# nginx: remove override headers before proxying to the application # (place with any other proxy_set_header directives in the same block) proxy_set_header X-HTTP-Method-Override ""; proxy_set_header X-HTTP-Method ""; proxy_set_header X-Method-Override "";

Confirm the fix by repeating the override requests and checking that they are rejected or processed with their original method, and that front-end restrictions on methods can no longer be bypassed.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More APIs Findings

Every APIs finding