ewitwer / maybenot-defenses

BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

port defenses to Maybenot v2 #1

Open ewitwer opened 3 months ago

ewitwer commented 3 months ago

The machines in this repository are designed for Maybenot v1, which in some cases severely limits their ability to properly replicate the behavior of the theoretical defenses they are based on.

Develop new versions of some or all of the machines that take advantage of the features added in Maybenot v2. This is most likely to be worthwhile for RegulaTor and Surakav, but may also be useful for FRONT.

moschramm commented 3 weeks ago

Hi, I want to use the Maybenot v2 framework in my research project and especially your defense implementations. Therefore I'm trying to port the machines to v2 starting with FRONT.

I got a working v2 machine for now (see here), but when I compare the simulator output of the v1 and the v2 implementation they look very different. The v2 version is sending much more padding packets. From my understanding both versions should be more or less identical (I only added an STATE_END to the v2 machine`). Do you have an Idea what may cause the divergent behavior?

# v1 FRONT sample trace output
sent a normal packet at 0 ms
received a normal packet at 19 ms
sent a normal packet at 183 ms
received a normal packet at 243 ms
sent a normal packet at 1696 ms
sent a normal packet at 2047 ms
received a normal packet at 2055 ms
sent a normal packet at 9401 ms
sent a padding packet at 9401 ms
sent a normal packet at 9401 ms
received a normal packet at 9420 ms
sent a padding packet at 9513 ms
sent a padding packet at 9626 ms
sent a padding packet at 9738 ms
sent a padding packet at 9851 ms
sent a padding packet at 9963 ms
sent a padding packet at 9963 ms
sent a padding packet at 9963 ms
sent a padding packet at 9963 ms
sent a padding packet at 10076 ms
sent a padding packet at 10076 ms
sent a padding packet at 10189 ms
sent a padding packet at 10301 ms
sent a padding packet at 10414 ms
sent a padding packet at 10414 ms
sent a padding packet at 10414 ms
sent a padding packet at 10461 ms
sent a padding packet at 10461 ms
sent a padding packet at 10461 ms
sent a padding packet at 10509 ms
sent a padding packet at 10522 ms
sent a padding packet at 10522 ms
sent a padding packet at 10522 ms
sent a padding packet at 10522 ms
sent a padding packet at 10522 ms
sent a padding packet at 10522 ms
sent a padding packet at 10554 ms
sent a padding packet at 10585 ms
sent a padding packet at 10617 ms
sent a padding packet at 10649 ms
sent a padding packet at 10680 ms
sent a padding packet at 10680 ms
sent a padding packet at 10712 ms
sent a padding packet at 10712 ms
sent a padding packet at 10744 ms
sent a padding packet at 10744 ms
sent a padding packet at 10775 ms
sent a padding packet at 10775 ms
sent a padding packet at 10807 ms
sent a padding packet at 10839 ms
# v2 FRONT sample trace output
sent a normal packet at 0 ms
received a normal packet at 19 ms
sent a padding packet at 112 ms
sent a padding packet at 112 ms
sent a normal packet at 183 ms
sent a padding packet at 225 ms
received a normal packet at 243 ms
sent a padding packet at 337 ms
sent a padding packet at 337 ms
sent a padding packet at 337 ms
sent a padding packet at 450 ms
sent a padding packet at 450 ms
sent a padding packet at 450 ms
sent a padding packet at 562 ms
sent a padding packet at 585 ms
sent a padding packet at 697 ms
sent a padding packet at 697 ms
sent a padding packet at 810 ms
sent a padding packet at 810 ms
sent a padding packet at 923 ms
sent a padding packet at 1035 ms
sent a padding packet at 1035 ms
sent a padding packet at 1148 ms
sent a padding packet at 1260 ms
sent a padding packet at 1260 ms
sent a padding packet at 1260 ms
sent a padding packet at 1373 ms
sent a padding packet at 1485 ms
sent a padding packet at 1485 ms
sent a padding packet at 1598 ms
sent a padding packet at 1711 ms
sent a padding packet at 1711 ms
sent a padding packet at 1711 ms
sent a padding packet at 1823 ms
sent a padding packet at 1823 ms
sent a padding packet at 1936 ms
sent a padding packet at 1936 ms
sent a padding packet at 1936 ms
sent a padding packet at 1936 ms
sent a padding packet at 1936 ms
sent a padding packet at 2048 ms
sent a padding packet at 2048 ms
sent a padding packet at 2048 ms
sent a padding packet at 2096 ms
sent a padding packet at 2143 ms
sent a padding packet at 2191 ms
sent a padding packet at 2238 ms
sent a padding packet at 2286 ms
sent a padding packet at 2286 ms
sent a padding packet at 2333 ms
sent a padding packet at 2333 ms
sent a padding packet at 2380 ms
sent a padding packet at 2380 ms
sent a padding packet at 2428 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2475 ms
sent a padding packet at 2523 ms
sent a padding packet at 2523 ms
sent a padding packet at 2523 ms
sent a padding packet at 2523 ms
sent a padding packet at 2570 ms
sent a padding packet at 2618 ms
sent a padding packet at 2665 ms
sent a padding packet at 2665 ms
sent a padding packet at 2665 ms
sent a padding packet at 2713 ms
sent a padding packet at 2760 ms
sent a padding packet at 2760 ms
sent a padding packet at 2760 ms
sent a padding packet at 2807 ms
sent a padding packet at 2807 ms
sent a padding packet at 2855 ms
sent a padding packet at 2902 ms
sent a padding packet at 2950 ms
sent a padding packet at 2950 ms
sent a padding packet at 2997 ms
sent a padding packet at 2997 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
sent a padding packet at 3045 ms
ewitwer commented 3 weeks ago

Hi! After a quick look through the code, it does seem that the two versions should behave identically. I'm not too familiar with the v1 simulator code, but my guess is that the main difference lies in updates to the simulator between v1 and v2.

In your v1 trace, no padding packets are sent before 9401 ms, which seems odd (and incorrect). Your v2 trace looks more like what I would expect. I am able to replicate this behavior using Maybenot v1 for the v1 machine and Maybenot v2 for the v2 machine. But when I use the parsing feature of Maybenot v2 to run the v1 machine, I get better output... I'll stick with my simulator theory. I'll bring this up with Tobias later this week and see if we come up with anything more specific, but my recommendation would be to consider this a non-issue in your work if you're using v2. It at least doesn't seem to have to do with the defense implementations.

Speaking of the simulator: I've spent some time working on a v2 version of RegulaTor "with all the bells and whistles" (the missing features/optimizations v1 doesn't support), but I haven't pushed the changes yet because their behavior has raised some important questions about how we should model the network in the Maybenot simulator. We are working to address these, so my hope is to have the machines uploaded rather soon - feel free to shoot me an email if you'd like a more detailed explanation or to discuss further.

moschramm commented 3 weeks ago

Thank you very much for your quick answer! You're probably right with the simulator theory, please shoot me a message if you find out anything more specific.

I'm very much interested in the new v2 version of RegulaTor as it's probably more relevant to my work than FRONT. I'm currently trying to port the v1 version to v2. I'll send you an email if I come up with more specific questions about that.

Thanks again.

moschramm commented 2 weeks ago

FYI, I did a quick port of RegulaTor to Maybenot v2 as well: maybenot_regulator.rs