Bypassing BurpSuite "Failed to connect to website:port" issue

Hi readers,
When performing penetration testing, it’s common to run into situations where an application or web portal works perfectly in a browser, but refuses to load once you route traffic through your interception proxy(e.g. Burp suite). Instead of the expected traffic flow, you might be greeted with errors such as:

Error
Failed to Connect to <website:port>


This happens because some applications and servers enforce stricter connection requirements, such as enforcing TLS versions, specific cipher suites, or HTTP/2 negotiation. which the proxy cannot always handle correctly on its own.

The Solution: Proxy Chaining (Upstream Proxy): 

The workaround is to introduce an additional proxy layer that sits between your BurpSuite and the destination server. Your interception proxy connects to this new proxy, which then handles the final connection to the target.

This approach is commonly called proxy chaining or upstream proxying. It ensures that your interception tool can still capture and modify traffic, while the upstream proxy takes care of establishing a compliant connection with the target.

Graphical representation of this architecture:

A Custom Python Proxy

To address this, I built a lightweight Python upstream proxy with the help of AI(no shame in accepting this) that acts as a middleman.

  • It listens locally on a port you define (e.g., default 127.0.0.1:8081).
  • It accepts connections from your BurpSuite proxy.
  • For normal HTTP requests, it forwards them to the target using modern libraries that support HTTP/2 and TLS 1.3.
  • For HTTPS (CONNECT requests), it sets up a raw tunnel, allowing your interception proxy to handle SSL/TLS interception as usual.
Script to download: https://github.com/aamir-rehman/Upstream-Proxy-for-Burp-or-anyother-proxy-
Make sure to install httpx before running the script --> pip install httpx

How to Run

  1. Save the script as bypass_proxy.py.

  2. Start it with: python bypass_proxy.py -p 8081 -v


Once the script is running, Go to 
BurpSuite proxy settings --> Network --> Upstream proxy server --> add the proxy details of this script.

For-example: destination host= *, proxy host=127.0.0.1, proxy port=8081 --> OK --> Make sure the checkbox is on/checked



Thats it, open the browser in which burp proxy is configured, and start browsing the webapp, now you will not see the error which we faced before, you can also see the logs in the script console.

The app started working and burp is capturing the traffic.




Happy hunting.









Comments

Popular posts from this blog

Ericsson BSCS iX R18 Billing & Rating (ADMX, MX) - Stored XSS (CVE-2020-29144, CVE-2020-29145)

Enjay CRM 1.0 - Multiple code executions via Unrestricted Terminal

ZKBio Time - CSV Injection (CVE-2022-40472)