Skip to content

mitmproxy 11 client replay upstream mode fails #7280

@ajinabraham

Description

@ajinabraham

Problem Description

mitmproxy 11 client replay upstream mode fails.

Steps to reproduce the behavior:

  1. mitmproxy 11.0 crashes doing a client reply of a flow file with upstream proxy set. Client replay works without upstream proxy configured. The same flow file works fine on mitmproxy 10 (it shows some errors, but repeating works)
  2. Install mitmproxy 10.0
pip install mitmproxy==10
# Create a flow file
mitmdump -p 9000 --save-stream-file foo

[14:34:03.491] HTTP(S) proxy listening at *:9000.
[14:34:16.250][127.0.0.1:52840] client connect
[14:34:16.301][127.0.0.1:52840] server connect google.com:443 (142.250.69.206:443)
127.0.0.1:52840: GET https://google.com/ HTTP/2.0
     << HTTP/2.0 301 Moved Permanently 220b
[14:34:16.392][127.0.0.1:52843] client connect
[14:34:16.414][127.0.0.1:52843] server connect www.google.com:443 (142.251.33.68:443)
127.0.0.1:52843: GET https://www.google.com/ HTTP/2.0
.......SNIPPED........
  1. Attempt client replay with the captured flow file using an upstream http proxy
mitmdump -nkC foo --mode upstream:http://localhost:8080

[14:34:34.961] [replay] mitmproxy has crashed!
[14:34:34.974] [replay] server connect localhost:8080 (127.0.0.1:8080)
[replay]: GET https://google.com/ HTTP/2.0
     << HTTP/2.0 301 Moved Permanently 220b
[14:34:35.081] [replay] server disconnect localhost:8080 (127.0.0.1:8080)
[14:34:35.082] [replay] mitmproxy has crashed!
[14:34:35.084] [replay] server connect localhost:8080 (127.0.0.1:8080)
[replay]: GET https://www.google.com/ HTTP/2.0
     << HTTP/2.0 200 OK 204k
[14:34:35.284] [replay] server disconnect localhost:8080 (127.0.0.1:8080)
[14:34:35.286] [replay] mitmproxy has crashed!
[14:34:35.288] [replay] server connect localhost:8080 (127.0.0.1:8080)

Although it shows mitmproxy has crashed! the reply works. Also not sure why it show that error.

  1. Attempt the same with mitmproxy 11
 pip install mitmproxy==11
 
 mitmdump -nkC foo --mode upstream:http://localhost:8080
[14:34:48.346] [replay] mitmproxy has crashed!
Error logged during startup, exiting...
[replay]: GET https://google.com/ HTTP/2.0
 << connection cancelled

Shows the same error, but this time exit at first error and does not repeat any request to upstream proxy.

  1. The client replay work without upstream proxy settings.
mitmdump -nkC foo                                      
[14:35:06.039] [replay] server connect google.com:443 (142.250.69.206:443)
[replay]: GET https://google.com/ HTTP/2.0
    << HTTP/2.0 301 Moved Permanently 220b
[14:35:06.088] [replay] server disconnect google.com:443 (142.250.69.206:443)
[14:35:06.097] [replay] server connect www.google.com:443 (142.251.33.68:443)
[replay]: GET https://www.google.com/ HTTP/2.0
    << HTTP/2.0 200 OK 62.8k
[14:35:06.213] [replay] server disconnect www.google.com:443 (142.251.33.68:443)
[14:35:06.223] [replay] server connect www.google.com:443 (142.251.33.68:443)
....SNIPPED....

I used both BurpSuite and ZAP with intercept mode off as upstream proxy.

System Information

Paste the output of "mitmproxy --version" here.

pip freeze | grep mitm
aioquic-mitmproxy==0.9.21.1
mitmproxy==11.0.0
mitmproxy-macos==0.9.3
mitmproxy_rs==0.9.3
urwid-mitmproxy==2.1.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions