# Forbidden | Bypass 4Xx HTTP Response Status Codes

**URL:** <https://onehack.st/t/forbidden-bypass-4xx-http-response-status-codes/208828>\
**Category:** Tools & Scripts\
**Tags:** tools, cracking\
**Created:** [December 6, 2021, 10:59am UTC](https://onehack.st/t/forbidden-bypass-4xx-http-response-status-codes/208828 "2021-12-06T10:59:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoBody](https://onehack.st/user_avatar/onehack.st/nobody/32/163880_2.png) [@NoBody](https://onehack.st/u/NoBody)\
**Post date:** [December 6, 2021, 10:59am UTC](https://onehack.st/t/forbidden-bypass-4xx-http-response-status-codes/208828/1 "2021-12-06T10:59:56Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/7/7/77dde96dc5730ee774b5ef4190027d20fd8728b1.png)

Bypass 4xx HTTP response status codes. Based on `PycURL`.

Script uses multithreading, and is based on brute forcing so might have some false positives. Script uses colored output.

Results will be sorted by HTTP response status code ascending, content length descending, and ID ascending.

To filter out false positives, check each content length manually with the provided `cURL` command. If it does not results in bypass, just ignore all other results with the same content length.

| Test | Scope |
| --- | --- |
| Various HTTP methods | method |
| Various HTTP methods with ‘Content-Length: 0’ header | method |
| Cross-site tracing (XST) with HTTP TRACE and TRACK methods | method |
| File upload with HTTP PUT method | method |
| Various HTTP method overrides | method-override |
| Various HTTP headers | header |
| Various URL overrides | header |
| URL override with two ‘Host’ headers | header |
| Various URL path bypasses | path |
| Various URL scheme overrides | scheme-override |
| Basic authentication/authorization including null session | auth |
| Broken URL parsers | parser |

Extend this script to your liking.

Good sources for HTTP headers:

- [Common HTTP Response Headers](https://webtechsurvey.com/common-response-headers)

Tested on Kali Linux v2021.4 (64-bit).

Made for educational purposes. I hope it will help!

Future plans:

- add option to test only allowed HTTP methods,
- add option to test a specific/custom HTTP header for all the domains/subdomains,
- add option to test less common/application specific HTTP headers,
- separate HTTP headers in categories to reduce false positive results,
- do not ignore URL parameters and fragments.

## Table of Contents

- [How to Run](https://github.com/ivan-sincek/forbidden#how-to-run)
- [Automation](https://github.com/ivan-sincek/forbidden#automation)
- [HTTP Methods](https://github.com/ivan-sincek/forbidden#http-methods)
- [HTTP Headers](https://github.com/ivan-sincek/forbidden#http-headers)
- [URL Paths](https://github.com/ivan-sincek/forbidden#url-paths)
- [Results Format](https://github.com/ivan-sincek/forbidden#results-format)
- [Images](https://github.com/ivan-sincek/forbidden#images)

## How to Run

Open your preferred console from [/src/](https://github.com/ivan-sincek/forbidden/tree/main/src) and run the commands shown below.

Install required tools:

```auto
apt-get install -y curl

```

Install required packages:

```auto
pip3 install -r requirements.txt

```

Run the script:

```auto
python3 forbidden.py

```

Be aware of rate limiting. Give it some time before you run the script again for the same domain in order to get better results.

Some websites require a user agent header. Download a user agent list from [here](https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/User-Agents/UserAgents.fuzz.txt).

## Automation

Bypass `403 Forbidden` HTTP response status code:

count=0; for subdomain in $(cat subdomains\_403.txt); do count=$((count+1)); echo “#${count} | ${subdomain}”; python3 forbidden.py -u “${subdomain}” -t method,method-override,header,path,scheme-override -f GET -o “forbidden\_403\_results\_${count}.json”; done

Bypass `401 Unauthorized` HTTP response status code:

count=0; for subdomain in $(cat subdomains\_401.txt); do count=$((count+1)); echo “#${count} | ${subdomain}”; python3 forbidden.py -u “${subdomain}” -t auth -f GET -o “forbidden\_401\_results\_${count}.json”; done

Broken URL parser check:

count=0; for subdomain in $(cat subdomains\_live\_long.txt); do count=$((count+1)); echo “#${count} | ${subdomain}”; python3 forbidden.py -u “${subdomain}” -t parser -f GET -o “forbidden\_parser\_results\_${count}.json”; done

# HTTP Methods

```auto
ACL
ARBITRARY
BASELINE-CONTROL
BIND
CHECKIN
CHECKOUT
CONNECT
COPY
DELETE
GET
HEAD
INDEX
LABEL
LINK
LOCK
MERGE
MKACTIVITY
MKCALENDAR
MKCOL
MKREDIRECTREF
MKWORKSPACE
MOVE
OPTIONS
ORDERPATCH
PATCH
POST
PRI
PROPFIND
PROPPATCH
PUT
REBIND
REPORT
SEARCH
SHOWMETHOD
SPACEJUMP
TEXTSEARCH
TRACE
TRACK
UNBIND
UNCHECKOUT
UNLINK
UNLOCK
UPDATE
UPDATEREDIRECTREF
VERSION-CONTROL

```

# HTTP Headers

Method override HTTP headers:

```auto
X-HTTP-Method
X-HTTP-Method-Override
X-Method-Override

```

HTTP headers:

```auto
Client-IP
Cluster-Client-IP
Connection
Contact
Forwarded
Forwarded-For
Forwarded-For-Ip
From
Host
Origin
Referer
Stuff
True-Client-IP
X-Client-IP
X-Custom-IP-Authorization
X-Forward
X-Forwarded
X-Forwarded-By
X-Forwarded-For
X-Forwarded-For-Original
X-Forwarded-Host
X-Forwarded-Server
X-Forward-For
X-Forwared-Host
X-Host
X-HTTP-Host-Override
X-Original-URL
X-Originating-IP
X-Override-URL
X-ProxyUser-IP
X-Real-IP
X-Remote-Addr
X-Remote-IP
X-Rewrite-URL
X-Wap-Profile
X-Server-IP
X-Target

```

Scheme override HTTP headers:

```auto
X-Forwarded-Proto
X-Forwarded-Protocol
X-Forwarded-Scheme
X-Url-Scheme
X-URLSCHEME

```

# URL Paths

Inject in front, back, and both front and back of URL path; with and without prepending and appending slashes.

```auto
/
//
%09
%20
%2e
.
..
;
.;
..;
;foo=bar;

```

Inject in back of URL path.

```auto
~
~~
~~random
*
**
**random
#
##
##random
?
??
??random

```

Inject in back of URL path only if URL path does not end with ‘/’.

```auto
.php
.jsp
.jspa
.jspx
.jhtml
.html
.sht
.shtml
.xhtml
.asp
.aspx
.esp

```

## Results Format

[{ “id”:501, “url”:“[http://example.com:80/admin](http://example.com:80/admin)”, “method”:“GET”, “headers”:[“Host: 127.0.0.1”], “agent”:“Forbidden/5.3”, “proxy”:null, “data”:null, “command”:“curl -m 5 --connect-timeout 5 -i -s -k -L --path-as-is -H ‘Host: 127.0.0.1’ -H ‘User-Agent: Forbidden/5.3’ -X ‘GET’ ‘[http://example.com:80/admin](http://example.com:80/admin)’”, “code”:200, “length”:255408 }, { “id”:541, “url”:“[http://example.com:80/admin](http://example.com:80/admin)”, “method”:“GET”, “headers”:[“Host: 127.0.0.1:80”], “agent”:“Forbidden/5.3”, “proxy”:null, “data”:null, “command”:“curl -m 5 --connect-timeout 5 -i -s -k -L --path-as-is -H ‘Host: 127.0.0.1:80’ -H ‘User-Agent: Forbidden/5.3’ -X ‘GET’ ‘[http://example.com:80/admin](http://example.com:80/admin)’”, “code”:200, “length”:255408 } ]

## Images

[![Help](https://github.com/ivan-sincek/forbidden/raw/main/img/help.png)](https://github.com/ivan-sincek/forbidden/blob/main/img/help.png)

Figure 1 - Help

## GitHub:

> **[GitHub - ivan-sincek/forbidden: Bypass 4xx HTTP response status codes and more....](https://github.com/ivan-sincek/forbidden)**
>
> Bypass 4xx HTTP response status codes and more. The tool is based on Python Requests, PycURL, and HTTP Client.
