Course contentsShow
← Security
Lesson 996 of 3,05221. Web Security - API SecurityFree lesson

HTTP Method Tampering and Verb Confusion

Test whether APIs properly restrict HTTP methods and handle method override headers like X-HTTP-Method-Override.

HTTP Method Tampering and Verb Confusion

What You'll Learn

You'll learn how attackers manipulate HTTP methods (verbs) to bypass security controls and access unauthorized functionality in APIs.

The Core Problem

Most APIs expect you to use specific HTTP methods: GET to read, POST to create, PUT to update, DELETE to remove. But what happens when developers only secure certain methods and forget others?

HTTP Method Tampering occurs when an attacker changes the HTTP verb to bypass authorization checks or discover hidden functionality. Many applications check permissions for GET or POST but ignore PUT, PATCH, or DELETE.

Verb Confusion happens when the server accepts multiple methods for the same endpoint but handles them inconsistently. For example:

  • GET /api/users/123 might require authentication
  • POST /api/users/123 to the same URL might not check permissions

Method Override Headers

Attackers also exploit special headers like X-HTTP-Method-Override or X-HTTP-Method. These were designed to help clients stuck with limited HTTP support (like old browsers), but they can trick servers:

POST /api/admin/delete-user HTTP/1.1
X-HTTP-Method-Override: DELETE

The server might treat this POST as a DELETE, bypassing any DELETE-specific restrictions.

Why This Matters

Imagine a door with five locks—but only the front two are actually engaged. An attacker tries different "keys" (HTTP methods) until they find one that opens the door without proper authorization checks. They might discover that while GET /api/config requires admin rights, HEAD /api/config returns the same data without any check.

Key Takeaway: Always test every HTTP method your API accepts for each endpoint, explicitly restrict unsupported methods, and be cautious with method override headers—they can turn security assumptions upside down.