jm33-m0 / emp3r0r

Linux/Windows post-exploitation framework made by linux user
https://infosec.exchange/@jm33
MIT License
1.26k stars 232 forks source link

Proxy: panic: Write called after Handler finished #37

Closed jm33-m0 closed 3 years ago

jm33-m0 commented 3 years ago

https://github.com/jm33-m0/emp3r0r/blob/d84b0d22a2dc4c152adbebfdda3da052328006bd/core/lib/cc/proxy.go#L211

emp3r0r @ubuntu\ubuntu_1179 (run_proxy) > panic: Write called after Handler finished

goroutine 4009 [running]:
net/http.(*http2responseWriter).write(0xc00047a048, 0x3, 0xc000366000, 0x3, 0x8000, 0x0, 0x0, 0x8, 0xc0004c4d40, 0x4b5c95)
        /usr/lib/go-1.13/src/net/http/h2_bundle.go:6233 +0x1fb
net/http.(*http2responseWriter).Write(0xc00047a048, 0xc000366000, 0x3, 0x8000, 0x503b4f, 0xc0005de180, 0xc000366000)
        /usr/lib/go-1.13/src/net/http/h2_bundle.go:6222 +0x56
github.com/posener/h2conn.(*flushWrite).Write(0xc000162240, 0xc000366000, 0x3, 0x8000, 0x50ff38, 0xc0005de180, 0xc000366000)
        /home/jm33/go/pkg/mod/github.com/posener/h2conn@v0.0.0-20180911140238-13e7df33ed15/server.go:72 +0x55
github.com/posener/h2conn.(*Conn).Write(0xc0004ea500, 0xc000366000, 0x3, 0x8000, 0x0, 0x0, 0x0)
        /home/jm33/go/pkg/mod/github.com/posener/h2conn@v0.0.0-20180911140238-13e7df33ed15/conn.go:35 +0xc7
io.copyBuffer(0x9acd20, 0xc0004ea500, 0x9acfc0, 0xc0004e8008, 0xc000366000, 0x8000, 0x8000, 0xc0004c4fa8, 0x64a91b, 0xcd3068)
        /usr/lib/go-1.13/src/io/io.go:404 +0x1fb
io.Copy(...)
        /usr/lib/go-1.13/src/io/io.go:364
github.com/jm33-m0/emp3r0r/core/lib/cc.(*PortFwdSession).RunPortFwd.func1.2(0xc0005dc1e0, 0xc0002446f0, 0x9bade0, 0xc0004e8008, 0xc0001920f0)
        /home/jm33/projects/emp3r0r/core/lib/cc/proxy.go:212 +0xdc
created by github.com/jm33-m0/emp3r0r/core/lib/cc.(*PortFwdSession).RunPortFwd.func1
        /home/jm33/projects/emp3r0r/core/lib/cc/proxy.go:210 +0x1d4
jm33-m0 commented 3 years ago

https://github.com/jm33-m0/emp3r0r/commit/34d6521b5aa9f7cc981a71fa1db5f7ecbcfd0fbb fixes this issue, at least practically, which means you are unlikely to see this panic during normal use.