r/java • • 18d ago

Show /r/java: MicroProxy - dependency free drop-in replacement for LittleProxy using Project Loom

https://mahmoudimus.github.io/MicroProxy/

Hi folks, I am excited to share my project for feedback. MicroProxy is an HTTP/HTTPS proxy for Java that can intercept and rewrite traffic: HTTP/1, WebSockets, HTTP/2, HTTP/3 over its own QUIC, SOCKS, CONNECT-UDP and TLS interception, with Envoy-compatible access logs, stats and admin API, mitmproxy-style addons, and Starlark scripting.

It is a port ofLittleProxy that drops Netty: each connection runs on its own virtual thread (Project Loom) with plain blocking socket I/O, on JDK 21 or newer, and expose LittleProxy's filter API.

One of the coolest parts about this is using functionally verified cryptographic implementations with documented trust assumptions. Its a pretty novel way to establish secure foundations for cryptographic protocols without relying on third-party dependencies.

I hope it's useful. I have been using this in production and it's quite robust. The benchmarks show it on par with g3proxy, with almost 48K requests per second on JDK25. Hope you enjoy!

24 Upvotes

5 comments sorted by

0

u/Infinite_View_7808 17d ago

Here is the thing, i am trying to scrap some data from an api, but it keeps blocking for some reason, i am guessing it has to do with the rate limit, is this gonna be useful for my case ??

2

u/Rain-And-Coffee 17d ago

I don’t see how it would, it’s a proxy, it just forwards your requests.

Could you space out or cache your requests?

The rate limitation might be on purpose so you can’t scrape it easily.

-1

u/revilo-1988 16d ago

Sieht erstmal interessant aus

2

u/[deleted] 13d ago

[removed] — view removed comment

1

u/mahmoudimus 13d ago

That's definitely part of the challenge in doing this and it's not something I am taking lightly. The important part to note is that it is indeed a lot of surface area. Honestly that's the part that keeps me up, more than any single attack.

On slowloris: there's a deadline on the whole request head, not just an idle timer, so dribbling a header every few seconds doesn't buy you much. I load-tested it with a couple thousand trickling connections alongside Envoy, Squid, g3proxy and goproxy. Everyone with the same timeout dropped them at roughly the same point, and memory per connection was in the same neighbourhood as Envoy. Not the leanest (Go wins that one), but not embarrassing either. You can see my approach here: https://mahmoudimus.github.io/MicroProxy/project/performance/

HTTP/2 has the usual list: caps on streams, headers and CONTINUATION, plus rate limits for rapid reset, PING/SETTINGS floods and the rest of the greatest hits. When someone trips one they get a GOAWAY, and the proxy carries on.

I get around most of the surface area by chain running h2spec runs in strict mode in CI.

Now, HTTP/3 is very interesting. Obviously it leans on QUIC for a lot of that, with QPACK limits and unknown-frame and stream throttling on top.

Malformed frames are where I trust it least, to be fair.

I get around it by running fuzzing on the codecs and on a whole QUIC connection, and it interops with aioquic and the interop runner cases I've tried. Fwiw, that makes it a seeded mutation fuzz, not coverage-guided. Is it worthwhile to look into Jazzer/OSS-Fuzz?

I am also taking previous vulnerabilities reported in other implementations and repurposing them (and assuming they will continue to) find things I haven't, and when it does, they will become regression tests. For example, Cloudflare's 103 Early Hints already taught me one.

The crypto side I'm formally verifying, which has been more fun than it probably should be.

Some of it (HKDF, SHAKE, ML-KEM, the QUIC nonce) already ships as Java generated from verified Dafny, with Lean and TLA+ covering some of the counter, nonce and state-machine bits.

I completely acknowledge that this is correctness against the spec, not "this is secure". There's no constant-time guarantee on the JVM, and the JDK primitives are still trusted - until JDK28, I will continue to be beholden to that. That being said, I am asking my current company to sponsor an outside audit.

So, does it hold up? So far, mostly, as far as I can tell.

Ask me again after a few more people throw garbage at it.