Skip to content
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

Problem with AppImages #408

Closed
mariomadproductions opened this issue May 7, 2021 · 11 comments
Closed

Problem with AppImages #408

mariomadproductions opened this issue May 7, 2021 · 11 comments

Comments

@mariomadproductions
Copy link

Hi. When using this app with an AppImage (ArchiveWeb.page, I noticed that there doesn't seem to be a way to create an exception that works for different instances of the process - because app images seem to have a randomised process path (e.g. /tmp/.mount_archivSJ24T4/archiveweb.page). Maybe there is some way to change the AppImage behaviour (but I don't know if that's a good idea), or maybe there is something that could be changed on OpenSnitch's side?

OS (please complete the following information):

  • OS: Linux Mint
  • Window Manager: Cinnamon
  • Kernel version: Linux pc 5.4.0-72-generic 'Namespace' object is not iterable #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Version: 20.1
@gustavo-iniguez-goya
Copy link
Collaborator

Hi @mariomadproductions ,

Thank you for reporting this behaviour. There's a way to filter connections from this appimage (I have no idea if it'd apply to all appimages):

[x] From this executable: ^(/tmp/\.mount_Archiv[0-9A-Za-z]+/archiveweb.page)$

I've tested it and it works, but I don't know if the random part of the path could contain more characters like _ or - (in such case you should just have to include them between the [ ]).

@mariomadproductions
Copy link
Author

mariomadproductions commented May 7, 2021

Ah, reading an old issue I was under the impression that regex didn't work. Just tried that - works fine. It looks to me that it just uses letters and numbers for the randomised bit.

@gustavo-iniguez-goya
Copy link
Collaborator

I'll add this information to the wiki, thank you!

@nitschis
Copy link

nitschis commented Jun 7, 2022

I think this should be automatic, as it would be too confusing for most people.

Correct me if I am wrong, but the example in the Wiki is not correct

[x] From this executable: ^(/tmp/.mount_Archiv[0-9A-Za-z]+/.*)$

"/tmp/.mount_Archiv" is only relevant for this example. So removing it makes it work with all apps.

^(/tmp/\.mount_[0-9A-Za-z]+/EXECUTEABLE)$

Maybe a new "AppImage" dropdown option could be added, which automatically adds the executable this way.

@NRGLine4Sec
Copy link
Contributor

@nitschis
For some AppImage, the executable is not in the root path in the tmp directory. For example :
^(/tmp/\.mount_KeePas.*/usr/bin/keepassxc)$

@gustavo-iniguez-goya
Copy link
Collaborator

Maybe a new "AppImage" dropdown option could be added, which automatically adds the executable this way.

I agree @nitschis . There's a feature request to add rules templates. We could add as you suggest a dropdown: AppImages, System Apps (ntpd, xbrlapi, dirmngr, /lib/systemd-*), etc

@mbnoimi
Copy link

mbnoimi commented Jul 19, 2022

Maybe a new "AppImage" dropdown option could be added, which automatically adds the executable this way.

+1

@Jabster28
Copy link

couldn't this be faked though? any application could make an executable under an appimage directory that they assume the host has, and now that new executable inherits the rules of the actual application

@gustavo-iniguez-goya
Copy link
Collaborator

gustavo-iniguez-goya commented Dec 23, 2022

Yes @Jabster28 . Given that the appimages are uncompressed to /tmp, anyone could brute force the temporary dirs that they create.

One way of mitigating this problem would be by creating restrictive rules. For example, instead of allowing only the cmdline, allow cmdline + UID + dst port + dst ip/host.

@nitschis
Copy link

I think a simple solution to this problem would be to save the checksum of the executable. This would be a security addition in general, but I think it should be optional to only use it with appimages.

@gustavo-iniguez-goya
Copy link
Collaborator

I agree, we've long discussed about this feature here #413

gustavo-iniguez-goya added a commit that referenced this issue Nov 24, 2023
If the path of the process starts with /tmp/.mount, it typically
indicates that the application is an AppImage.

These apps create a random directory under /tmp, with the pattern
/tmp/.mount_<appId>XXXXXX, where the AppImage is mounted (it's not
always the case, but it usually is).

https://github.com/AppImage/AppImageKit/blob/a0373541c1005153199aaaaceb6c17803805e648/runtime.c#L202

The problem is that if you allow the path to the executable, the next
time you launch the AppImage, the path won't match the rule, and you'll
be prompted again to allow the outbound connection.

So as a helper for the users, if we find the path of the process starts
with /tmp/.mount_, we add an option to the combo box to select the path,
which creates a regular expression to match the AppImage.

Requested here: #1066, #543, #408
gustavo-iniguez-goya added a commit that referenced this issue Jan 8, 2024
If the path of the process starts with /tmp/.mount, it typically
indicates that the application is an AppImage.

These apps create a random directory under /tmp, with the pattern
/tmp/.mount_<appId>XXXXXX, where the AppImage is mounted (it's not
always the case, but it usually is).

https://github.com/AppImage/AppImageKit/blob/a0373541c1005153199aaaaceb6c17803805e648/runtime.c#L202

The problem is that if you allow the path to the executable, the next
time you launch the AppImage, the path won't match the rule, and you'll
be prompted again to allow the outbound connection.

So as a helper for the users, if we find the path of the process starts
with /tmp/.mount_, we add an option to the combo box to select the path,
which creates a regular expression to match the AppImage.

Requested here: #1066, #543, #408

(cherry picked from commit 56775cd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants