browserup / browserup-proxy

BrowserUp Proxy is a free utility to watch, test, and manipulate web application network traffic and performance.
https://browserup.com
Apache License 2.0
164 stars 41 forks source link

Error with MITM + Selenium #202

Open 0M1N0U5 opened 4 years ago

0M1N0U5 commented 4 years ago

Describe the bug I have this example code:

`BrowserUpProxy browserUpServer = new BrowserUpProxyServer(); //browserUpServer.addFirstHttpFilterFactory(new RequestFilterAdapter.FilterSource(requestFilter, 83886080)); //browserUpServer.addLastHttpFilterFactory(new ResponseFilterAdapter.FilterSource(responseFilter, 83886080)); browserUpServer.start();
System.out.println("Iniciado proxy en puerto: "+ browserUpServer.getPort());
Proxy seleniumProxy = ClientUtil.createSeleniumProxy(new InetSocketAddress("localhost", browserUpServer.getPort()));
System.setProperty("webdriver.chrome.driver","chromedriver.exe"); System.setProperty("webdriver.firefox.marionette","geckodriver.exe");
ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.setAcceptInsecureCerts(true); chromeOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); chromeOptions.setCapability(CapabilityType.PROXY, seleniumProxy);

chromeOptions.setProxy(seleniumProxy); SeleniumDrivers.primitiveDriver = new ChromeDriver(chromeOptions);`

And when i open a https web i have this error:

io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Insufficient buffer remaining for AEAD cipher fragment (2). Needs to be more than or equal to IV size (8) + tag size (16) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:472) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491) [netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) [netty-all-4.1.34.Final.jar:4.1.34.Final] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_231] Caused by: javax.net.ssl.SSLException: Insufficient buffer remaining for AEAD cipher fragment (2). Needs to be more than or equal to IV size (8) + tag size (16) at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) ~[na:1.8.0_231] at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1709) ~[na:1.8.0_231] at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:970) ~[na:1.8.0_231] at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:896) ~[na:1.8.0_231] at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:766) ~[na:1.8.0_231] at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624) ~[na:1.8.0_231] at io.netty.handler.ssl.SslHandler$SslEngineType$3.unwrap(SslHandler.java:295) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1330) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1225) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1272) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:441) ~[netty-all-4.1.34.Final.jar:4.1.34.Final] ... 15 common frames omitted Caused by: javax.crypto.BadPaddingException: Insufficient buffer remaining for AEAD cipher fragment (2). Needs to be more than or equal to IV size (8) + tag size (16) at sun.security.ssl.CipherBox.applyExplicitNonce(CipherBox.java:936) ~[na:1.8.0_231] at sun.security.ssl.CipherBox.applyExplicitNonce(CipherBox.java:993) ~[na:1.8.0_231] at sun.security.ssl.InputRecord.decrypt(InputRecord.java:157) ~[na:1.8.0_231] at sun.security.ssl.EngineInputRecord.decrypt(EngineInputRecord.java:177) ~[na:1.8.0_231] at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:963) ~[na:1.8.0_231] ... 24 common frames omitted

Expected behavior I want to use a request filter for modify request when X conditions are true but this part of code is commented.

Why i get this error on console?

Please complete the following information: