Skip to contentSkip to conversation

Has openvpn been fuzzed?

Openvpn-devel Jacek Wielemborek 4 participants 11 messages Feb 18, 2016 – Mar 11, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

I had been fascinated by afl-fuzz for quite a couple months so far and based on how efficient it is in finding bugs in open source projects, I'd like to ask the OpenVPN community whether somebody here tried out this tool on this project.

If not, you might be interested in my project that automates recompilation of openvpn with afl-gcc:

https://github.com/d33tah/aflize

Just run "aflize openvpn" and you'll get build environment ready in minutes.

Let me know if you'd like any help fuzzing OpenVPN, I'd be happy to assist you guys :)

Cheers,
d33tah

#1 lore raw

Hi d33tah,

Quoted 8 lines · Jacek Wielemborek

I had been fascinated by afl-fuzz for quite a couple months so far and based on how efficient it is in finding bugs in open source projects, I'd like to ask the OpenVPN community whether somebody here tried out this tool on this project.

If not, you might be interested in my project that automates recompilation of openvpn with afl-gcc:

Quoted 6 lines

https://github.com/d33tah/aflize

Just run "aflize openvpn" and you'll get build environment ready in minutes.

Let me know if you'd like any help fuzzing OpenVPN, I'd be happy to assist you guys :)

Thank you. This has been on my todo-list for ages now, but never got around to doing something with it.

I'm not aware of any openvpn fuzzing with tools like afl. OpenVPN does have an internal, simple, fuzzer for network traffic, which randomly flips bits. Look for 'gremlin' in the source.

-Steffan

#2 lore raw

W dniu 18.02.2016 o 17:01, Steffan Karger pisze:

Quoted 18 lines

Hi d33tah,

Quoted 8 lines · Jacek Wielemborek

I had been fascinated by afl-fuzz for quite a couple months so far and based on how efficient it is in finding bugs in open source projects, I'd like to ask the OpenVPN community whether somebody here tried out this tool on this project.

If not, you might be interested in my project that automates recompilation of openvpn with afl-gcc:

Quoted 6 lines

https://github.com/d33tah/aflize

Just run "aflize openvpn" and you'll get build environment ready in minutes.

Let me know if you'd like any help fuzzing OpenVPN, I'd be happy to assist you guys :)

Quoted 8 lines

Thank you. This has been on my todo-list for ages now, but never got around to doing something with it.

I'm not aware of any openvpn fuzzing with tools like afl. OpenVPN does have an internal, simple, fuzzer for network traffic, which randomly flips bits. Look for 'gremlin' in the source.

-Steffan

I'd have to know more about this gremlin to be able to tell whether it could help in fuzzing OpenVPN with AFL. Definitely doing more than just randomly flipping bits would help - AFL would use a genetic algorithm that would watch for changes in code coverage based on input mutations.

The thing is that in order to fuzz it most efficiently, it would be good to modify the server to use stdin/stdout (or dev null) for network I/O and terminate after handling a single connection. Also, we would need to disable any checksums, compression or encryption.

How difficult would that be?

#3 lore raw

Hi Jacek,

I'm definitely no expert in AFL, but it's a great tool that has shown great potential.

Quoted 2 lines

... it would be good
to modify the server to use stdin/stdout (or dev null) for network I/O

You might want to try https://github.com/zardus/preeny .

Best,
Fish

#4 lore raw

W dniu 18.02.2016 o 17:55, Fish Wang pisze:

Quoted 11 lines

Hi Jacek,

I'm definitely no expert in AFL, but it's a great tool that has shown great potential.

Quoted 2 lines

... it would be good
to modify the server to use stdin/stdout (or dev null) for network I/O

You might want to try https://github.com/zardus/preeny .

Best,
Fish

Yes, preeny would definitely help, but still some projects make some network operations or use stdin before they handle network, which is why I explicitly mention that this has to be done. It might be easy, it might be not - depends on what OpenVPN actually does (I hadn't looked at its protocol yet)

#5 lore raw
In reply to Jacek Wielemborek

Hi,

Quoted 4 lines · Jacek Wielemborek

The thing is that in order to fuzz it most efficiently, it would be good to modify the server to use stdin/stdout (or dev null) for network I/O and terminate after handling a single connection. Also, we would need to disable any checksums, compression or encryption.

OpenVPN can be called from inetd, so it can sort of handle "an already connected socket on stdin/stdout".

"sort of" because the backend refuses most normal options in this case (it can only handle tap interfaces, and no --ifconfig, because the assumption is that this only makes sense if you attach to a pre-configured bridge) - but for fuzzing the network side, this should work.

Of course, if you take out checksumming, encryption and tls-auth, you take away two layers of hardening against funny packets... - but I'm still fairly confident that the worst thing our code will do is ASSERT() on you :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#6 lore raw

W dniu 18.02.2016 o 18:03, Gert Doering pisze:

Quoted 16 lines

Hi,

Quoted 4 lines · Jacek Wielemborek

The thing is that in order to fuzz it most efficiently, it would be good to modify the server to use stdin/stdout (or dev null) for network I/O and terminate after handling a single connection. Also, we would need to disable any checksums, compression or encryption.

OpenVPN can be called from inetd, so it can sort of handle "an already connected socket on stdin/stdout".

"sort of" because the backend refuses most normal options in this case (it can only handle tap interfaces, and no --ifconfig, because the assumption is that this only makes sense if you attach to a pre-configured bridge) - but for fuzzing the network side, this should work.

Quoted 6 lines

Of course, if you take out checksumming, encryption and tls-auth, you take away two layers of hardening against funny packets... - but I'm still fairly confident that the worst thing our code will do is ASSERT() on you :-)

gert

Well the attacker could send a funny packet with a valid checksum, encrypted and authenticated, right? This is just to make AFL's genetic algorithm work well.

The inetd mode sounds like a perfect start.

#7 lore raw

Hi,

Quoted 2 lines · Jacek Wielemborek

Well the attacker could send a funny packet with a valid checksum, encrypted and authenticated, right?

Indeed, but that would be someone we trust enough to let him talk to our network - protects against Joe Random from the Internet crashing our servers (or burning CPU resources trying to).

But yeah. Mistakes do happen :-) - so software shouldn't ever crash on malformed packets.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#8 lore raw

W dniu 18.02.2016 o 19:08, Gert Doering pisze:

Quoted 6 lines

Hi,

Quoted 2 lines · Jacek Wielemborek

Well the attacker could send a funny packet with a valid checksum, encrypted and authenticated, right?

Quoted 9 lines

Indeed, but that would be someone we trust enough to let him talk to our network - protects against Joe Random from the Internet crashing our servers (or burning CPU resources trying to).

But yeah. Mistakes do happen :-) - so software shouldn't ever crash on malformed packets.

gert

Crashing alone isn't as dangerous as having memory errors that could lead to arbitrary code execution. Especially if OpenVPN is run as root, which is probably the case quite often, given that one of its most common use cases requires privileges to set up its own network interfaces...

#9 lore raw
In reply to Gert Doering

W dniu 18.02.2016 o 19:08, Gert Doering pisze:

Quoted 6 lines

Hi,

Quoted 2 lines · Jacek Wielemborek

Well the attacker could send a funny packet with a valid checksum, encrypted and authenticated, right?

Quoted 8 lines

Indeed, but that would be someone we trust enough to let him talk to our network - protects against Joe Random from the Internet crashing our servers (or burning CPU resources trying to).

But yeah. Mistakes do happen :-) - so software shouldn't ever crash on malformed packets.

gert

For the record, I'm unsubscribing I hadn't heard a response for quite a while and I'm not interested in other openvpn-devel topic. Please CC me if you'd like to continue the discussion with me.

#10 lore raw

[Openvpn-devel] AFL-Fuzzing OpenVPN in inetd mode?

In reply to Gert Doering

W dniu 18.02.2016 o 18:03, Gert Doering pisze:

Quoted 8 lines

Hi,

Quoted 4 lines · Jacek Wielemborek

The thing is that in order to fuzz it most efficiently, it would be good to modify the server to use stdin/stdout (or dev null) for network I/O and terminate after handling a single connection. Also, we would need to disable any checksums, compression or encryption.

Quoted 7 lines

OpenVPN can be called from inetd, so it can sort of handle "an already connected socket on stdin/stdout".

"sort of" because the backend refuses most normal options in this case (it can only handle tap interfaces, and no --ifconfig, because the assumption is that this only makes sense if you attach to a pre-configured bridge) - but for fuzzing the network side, this should work.

I read up on inetd mode and couldn't find a working example. Could someone show me a setup where I could make it read a request from stdin and ideally make it terminate after a sample request? Then I could start trying to plug it into AFL.