-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Application path manipulation #12
Comments
That's my doing, so that I can get the name of the script being run by an interpreter. If you know of a better way to get that information I'm happy to change it. |
I don't know either, sorry :/ Maybe a ghetto-mitigation would be to check that |
ckuethe wrote:
When I was posed with the same issue while working on onion-grater (note that this is not the upstream repo, which seems to not be publicly accessible at the moment, whatever) I could only find that AppArmor confined scripts have a safe way to make a PID to script path mapping. Of course, using that approach limits you to AppArmor confined scripts only, which was fine for my case, but clearly isn't for your. Any way, here's the code: https://github.com/Whonix/onion-grater/blob/master/usr/lib/onion-grater#L169 If you find a general purpose solution, I'm all ears! :) jvoisin wrote:
I don't get how that changes anything. The application then just has to add that part in the beginning, followed by the application it wants to spoof (the "script"), right? |
An application could spoof its script, but not its interepreter name; hence the term "ghetto-mitigation" :D |
Ah, now I got what you meant. But it still sucks! :) Using that trick, when you add an exception to |
Also, |
|
I'm not sure I'd ever whitelist an application entirely, especially not an interpreter. exe may not even be found in comm or cmdline. Clearly it's hard to get a trustworthy snapshot of arguments, process name, etc. :(
Which is expected given the first line of the script:
However
or
|
jvoisin wrote:
My Let's just make it clear that your mitigation won't work: so reading
I.e. you can set it however you like. Of course, to not overwrite important memory, call the program with atkeast 41 characters as the first argument. :) So let's say we have an |
Which is actually Non-malicious programs do this too. The MySQL client will censor its own argv in an attempt to reduce exposure of the password if you give it on the command line. |
ckuethe wrote:
I think full application granularity is the best we can except from average users. If that isn't your intended audience: fair enough! :)
Of course! That's why you have this pid-to-script-path workaround in the
... it's unfortunate that the Linux kernel doesn't provide anything to help us. :/ It'd be great if Linux recorded Hm. This actually sounds like a great idea, or am I missing something obvious? If not, I believe it would offer us the perfect solution for |
I was just thinking about tossing together a quick kernel module to snapshot that information at exec() time. Or maybe abuse apparmor by creating a profile to audit everything's command line arguments and not interfere with any other operation (unless overridden by a more specific policy) |
A kernel module sounds like a great idea (and, surprisingly, the easiest way to go). It would be amazing to get it merged upstead. Until this, I would recommend to stick with |
I can look at making sure that exe, comm, and cmdline are all exposed to the UI, maybe with a tooltip to warn the user that a process can manipulate this information. |
"Here are the process information, they might be wrong, it's up to you to trust them" doesn't sound like a good UX design to me :D |
ckuethe wrote:
Same here, it looks like the kernel hacking project I've been looking for for some time (i.e. something I feel motivated about). :)
When I was faced with this problem, that's what I did, i.e. I created "empty" profiles that
I don't think this will change anything from the user's PoV. They still won't get any help to make the right decision, because the information they get cannot be trusted (except exe). |
jvoisin wrote:
I'll start looking into it now! This will be useful for
You mean, to remove the workaround (based on comm and cmdline) for interpreted applications? If so I think I agree, even if that cripples
I believe it is. I'm cloning Linux' Git right now, will have a look once it's done. |
Yes I do :) |
I had a look at the kernel module idea for a few hours today:
Any way, it definitely seems like more work than I initially thought, so it's not clear if I'll have the time to work on this. :/ |
Guys ... IDEA! Maybe we can use |
Simone Margaritelli:
Guys ... IDEA! Maybe we can use `ftrace` kernel feature like [they do](https://github.com/Cybereason/linux_plumber/blob/master/plumber.py#L57) in order to intercept calls to `exec` ? :)
While this is an improvement, I think there are some remaining problems, some fixable, some not. A fixable issue is that you also have to intercept `sys_execveat` calls since they too can modify `argv`. But an unfixable, fundamental limitation of this approach is that processes started before `ProcMon` (and, hence, `opensnitch`) can still spoof their command-lines and get away with it.
So, for a safe solution I believe we need a kernel-level fix. :/
|
I think that it's an acceptable trade-off. |
@fred-a-kemp, @jvoisin and @ckuethe IMHO even before that we'll need to: Split the project into
Questions:
|
|
Nooooo IRC no please XD |
Then whatever fits :D |
First.last@gmail |
@ckuethe no such info on your profile man :) |
there is now :) |
sent ;) |
Simone Margaritelli:
@fred-a-kemp, @jvoisin and @ckuethe IMHO even before that we'll need to:
Split the project into `opensnitchd`, `opensnitch-ui` and `opensnitch-ruleman`:
* `opensnitchd` will be a C++ daemon, running as root with the main logic.
Sorry for the hate, but why C++? Sure, if you'll restrict yourself to some "safe" subset of C++, with a stack-first memory allocation approach, employing modern features like smart pointers to get memory safety if dynamic memory allocation is needed, etc. then I guess it is ok. That said, I do not really see what benefit we'd get from moving away from Python.
BTW, I assume you intend to put the `ProcMon` functionality into the `opensnitchd` daemon. Since other projects might be interested in only the `ProcMon` bits you may want to split it into another daemon (perhaps `openinformantd`? :P), dedicated to keeping track of process information.
Questions:
1. What is the best IPC method in this case? I mean, if the daemon just creates a unix socket readable and writable by any user, any third party malicious software could access it and simply `ACCEPT` every packet ... dbus? No idea how it works honestly.
Make the socket only accessible by members of the `opensnitch` group. If you go the DBus way you can define security policies with the same restrictions (see `dbus-daemon(1)`, search for "<policy>").
2. What's the best way in your opinion to keep all the involved/interested developers in sync and let them communicate without using github issues? Mailing list? Slack? Pigeons?
Personally I find issue/ticket/bug trackers the ideal place for development discussion. :)
|
LOL What's wrong with you guys and C++? :D JK, dunno since handling the connections is not very performance centric maybe you're right, we can keep it in python.
Why split it into two daemons? Maybe create a proper python library/module for reusability, but I'd rather have 1 daemon and 1 UI process.
Will take a look, tnx. |
@evilsocket Would you mind inviting me too? :) My email address is in my git commits Author field |
@adisbladis sure! it's the one bound to your gpg key id I guess, right? |
opensnitchd.service: update upstream url in
Currently, opensnitch is using
/proc/self/cmdline
and/proc/self/comm
, but they can easily be manipulated by a malicious application, and thus shouldn't be trusted.The text was updated successfully, but these errors were encountered: