-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client/server_args with spaces in them? #6
Comments
Just adding multiple args should work, similar to this: FitM/config/fitm-args.ts3.json Line 10 in 6e851f3
You'd do for example "server_args": ["--server", "--arg1", "value1", "--arg2", "value2", "--arg3"], |
Thanks, this does get me further. After completing this I run into criu complaining that it wants netspace to dump a tun link: (00.012713) Error (criu/tun.c:306): tun: Net namespace is required to dump tun link So I thought, ok thats easy, run the binary via unshare -n, however now I run into a similar problem to my args. It looks like the spaces are stripped out of the command. I did try ["modifying", "the", "client"], etc lines similarly to the args lines, but it seems it wants a string and not a sequence. I guess this means I cant fuzz this application in this way? |
The arg list gets passed to the final process here: Line 296 in 6e851f3
It should not strip anything? |
Its not the arg list I am struggling with now, criu wants the application running in a separate namespace (I believe?) so I tried modifying "client": and "server": lines adding /usr/bin/unshare -n to the start. Like "client": "/usr/bin/unshare -n /path/to/binary", Upon running it like this I get a "no such file or directory" error in active-state/stdout which suggests to me that the spaces are being stripped out of the binary path? |
Ah yes you want to specify the files to be included in the namespace/snapshot, see FitM/config/fitm-args.ts3.json Line 15 in 6e851f3
Basically the namespace starts a new chroot env and we copy everything we need into it to run |
I am not sure what you mean here, I tried adding the path to the directory with the binary in it to "server_files": ["/path/to/dir/with/binary"] But I still see Error while loading /usr/bin/unshare -n /path/to/dir/with/binary/actualbinary: No such file or directory in active-state/stdout so I feel like I am barking up the wrong tree? |
The path inside the namespace might be different, the files get copied in, if that makes sense? |
I am already running with "server_envs": {"QEMU_STRACE": "1"}, Where would I see the errors which might help me diagnose what is wrong? What is server_files supposed to be set to? Full path to each required binary? Something else? |
You'd see it in the stderr file (or whatever the name is). |
Because criu is complaining that I need one if I dont use one: (00.012713) Error (criu/tun.c:306): tun: Net namespace is required to dump tun link Maybe its not possible to fuzz vpn server/client in this manner? |
I guess the tub device needs to be part of the namespace? It's a rather low level component, I wouldn't know the answer. Likely our network emulator wouldn't work on the tun device, either |
I am only really interested in fuzzing the negotiation phase of the connection, not the established connection once its created (where data would flow over the tun device). Does this change anything? |
Can you maybe nop out all tun device interactions? That'd probably be the easiest solution. |
Heyhey, Can you try changing this line to look like this: I am not sure if you really want to do this as your target might now not have access to the tun interface that you possibly created manually in the initial net ns(?). |
Thanks for your input. Running the entire session in an 'unshare -n /bin/bash' session, and the edit you posted above both result in things getting further before bailing out. Both methods seem to achieve the same outcome. It now seems to be bailing out because its trying to read from /dev/urandom which apparently isnt available. I did try adding /dev/urandom to the server_files but this didnt help. |
My guess would be that something gets messed up with /dev because/while we are creating a new mount ns before restoring. I will have to take another look tomorrow :) |
Hm. So I have been trying to open /dev/urandom in the restore script while having the above patch in If so you could patch do_openat to gather some information on what is there and what isn't. Not sure what to look for here. A way to fake
Hope this helps! |
Thanks, very interesting points. I had presumed that for fuzzing purposes a static set of 'random' data might be better as I've had interesting problems fuzzing stuff that uses random data inputs in the past. I am only guessing at the issue here. A fresh pair of eyes suggests I actually still have a namespace related problem. I get the same pattern of errors with the patch above, or running inside bash ran via unshare -n. Here is more information: sudo rm -rf ./active-state
/ / / _/ |/ / File fitm-state.json not found. Restarting from scratch. End of criu.log: (00.014877) 16865 fdinfo 9: pos: 0 flags: 104002/0 stderr file: 16865 brk(NULL) = 0x0000004000220000 To me this seems the issue is more complicated than I originally thought, perhaps the netspace issue is not resolved though it appears to be getting further when ran with the patch above, or via bash started with unshare -n. |
Do you want to have a debugging session to take a look? Somewhere, where I can contact you? |
Sure, do you have an email address or method I can contact you off list? |
Use this :) |
After having a debugging session we found that adding an |
Hiya, Many thanks once again for taking the time to look at this at the week end and indeed sharing this interesting project. I've had this running for a few days now, number of testcases is increasing gradually in the expected manner. No errors to note really as far as I can see. I am still not getting any generation 3 snapshots, but this may be expected? Since I now have a pile of test cases I am of course now itching to perform some manual triage of these to see if anything exciting is happening. There doesn't seem to be much documentation in regard of where to even begin with this. The test cases look somewhat like a dump of the traffic between the two daemons being tested, however I tried replaying them like a PCAP file, feeding them into restore.sh, etc and am not getting anywhere. Presumably the best way to triage this further would be to 'replay' the test case, capturing STDOUT/STDERR for client/server and a pcap file of the traffic which results. I can then perform automated analysis of the output looking for anything interesting but since I lack an understanding of what format the testcases are taking I'm not sure where to begin... alan@debian-KVM:~/scratch/FitM/active-state$ sudo ./restore.sh ../cmin-tmp/imported1000
|
Hi,
Thanks for sharing this interesting work!
I am trying to fuzz a proprietary binary/client where client_args and server_args have spaces in them - for example --server --arg1 value1 --arg2 value2 --arg3
I am fairly sure I am missing something json related here but if I try to run the session with just 1 argument I get expected output, if I try with 2 arguments I get output I would expect if I missed the spaces out.
I am guessing I need to do something different to ensure the spaces are not stripped as if I recall correctly json strips spaces out, any pointers would be appreciated?
Alan
The text was updated successfully, but these errors were encountered: