zardus / preeny

Some helpful preload libraries for pwning stuff.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with getting it to work

opened this issue · comments

Hi,

While testing the desock.so with provided "sock" program from tests folder, when executing it, it doesn't go further than printing "HI!", I would also think it should print "You wrote: HI!".

user@user-lap:~/preeny/tests$ LD_PRELOAD=../x86_64-linux-gnu/desock.so ./sock
HI!
^C

Turned on debugs in desock and this is what it shows:

user@user-lap:~/preeny/tests# LD_PRELOAD=../x86_64-linux-gnu/desock.so ./sock
+++ Intercepted socket()!
+++ ... created socket pair (3, 4)
+++ ... dup into socketpair (3, 503)
+++ starting forwarding from 0 to 503!
+++ starting forwarding from 503 to 1!
+++ read 0 bytes from 503 (will write to 1)
HI!
+++ wrote 4 bytes to 1 (had read from 503)
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 0
read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 0
read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 0
read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 503
read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 0
read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 503
read poll() timed out on fd 0
+++ +++ read poll() timed out on fd 503
read poll() timed out on fd 0
+++ +++ read poll() timed out on fd 503
read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ +++ read poll() timed out on fd 0
read poll() timed out on fd 503
+++ +++ read poll() timed out on fd 503
read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ read poll() timed out on fd 503
+++ read poll() timed out on fd 0
+++ +++ read poll() timed out on fd 0
read poll() timed out on fd 503

I am also unable to use it with different programs.

My system is Ubuntu 14.04 LTS.

What could be wrong?

desock.c code expects the user to input a 5-byte string (counting /0), which it then checks with an assert.
It then prints out "You wrote: @", where @ is the inserted string.
Note that on Ubuntu 18.04 I had to fflush(zomg) (the file descriptor variable) to get the test program to actually print out the string.

My current concern when testing on nginx is requiring changes to nginx code to flush the socket's file descriptor, since a simple GET request does not get printed out, which is making me suspicious on whether desock is working as intended or not.. logging with preeny_debug on shows that it shuts down after 1 GET, which it wasn't meant to do, so something is still off for me...

oh, the exit behavior is answered in issue #63 , it's meant to exit.