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

hashcat: failure with private-dev & private-bin #6364

Open
5 of 7 tasks
schrotthaufen opened this issue Jun 2, 2024 · 4 comments
Open
5 of 7 tasks

hashcat: failure with private-dev & private-bin #6364

schrotthaufen opened this issue Jun 2, 2024 · 4 comments

Comments

@schrotthaufen
Copy link

schrotthaufen commented Jun 2, 2024

Description

The default profile for hashcat uses, private-bin, and private-dev, which break hashcat.
I have a AMD RX 7900 XT GPU.

Steps to Reproduce

  1. Run in bash LC_ALL=C firejail hashcat -b -m 1000

Expected behavior

hashcat starts working.

Actual behavior

  • With private-bin hashcat: hashcat throws an error, and quits: /usr/local/bin/OpenCL/: No such file or directory
  • With private-dev: hashcat throws an error, and quits: No devices found/left.

Behavior without a profile

hashcat works as expected.

Additional context

I think /dev/kfd is required to make private-dev work, but if I pass --whitelist=/dev/kfd, the /dev/ directory is empty.

Environment

  • Arch Linux, kernel 6.9.3-arch1-1
  • firejail version 0.9.72
    Compile time support:
    • always force nonewprivs support is disabled
    • AppArmor support is enabled
    • AppImage support is enabled
    • chroot support is enabled
    • D-BUS proxy support is enabled
    • file transfer support is enabled
    • firetunnel support is disabled
    • IDS support is disabled
    • networking support is enabled- output logging is enabled
    • overlayfs support is disabled
    • private-home support is enabled
    • private-cache and tmpfs as user enabled
    • SELinux support is disabled
    • user namespace support is enabled
    • X11 sandboxing support is enabled

Checklist

  • The issues is caused by firejail (i.e. running the program by path (e.g. /usr/bin/vlc) "fixes" it).
  • I can reproduce the issue without custom modifications (e.g. globals.local).
  • The program has a profile. (If not, request one in https://github.com/netblue30/firejail/issues/1139)
  • The profile (and redirect profile if exists) hasn't already been fixed upstream.
  • I have performed a short search for similar issues (to avoid opening a duplicate).
    • I'm aware of browser-allow-drm yes/browser-disable-u2f no in firejail.config to allow DRM/U2F in browsers.
  • I used --profile=PROFILENAME to set the right profile. (Only relevant for AppImages)
@rusty-snake
Copy link
Collaborator

Related: #6148

@glitsj16
Copy link
Collaborator

glitsj16 commented Jun 2, 2024

Thanks for reporting. Sadly my current hardware is partly broken so I can't reliably test hashcat. I do have a few questions/remarks.

With private-bin hashcat: hashcat throws an error, and quits: /usr/local/bin/OpenCL/: No such file or directory

Do you have binaries installed under that /usr/local/bin/OpenCL/ path (or under /usr/bin)? Just asking because instead of dropping private-bin we might be able to keep that and add the needed binary name(s) to it.

After installing the hashcat package and running hashcat -h I noticed it creates only two directories under ${HOME}:

  • ${HOME}/.cache/hashcat
  • ${HOME}/.local/share/hashcat

The referenced ${HOME}/.hashcat does not exist on my box after running the app (unsandboxed). Do you have that dir on your Arch Linux machine?
This isn't directly related to this issue IMO, but it would be nice to update the profile accordingly if we can check/confirm these discrepancies.

Regards

@schrotthaufen
Copy link
Author

Do you have binaries installed under that /usr/local/bin/OpenCL/ path (or under /usr/bin)?

Hashcat is installed to /usr/bin/, but I have firejail symlinks in /usr/local/bin/ (generated with firecfg). When I run firejail /usr/bin/hashcat -b -m 1000, I only get the No devices found/left. error. Maybe the OpenCL path issue is because the sandboxed hashcat can´t find /usr/share/hashcat/OpenCL/, and so it tries to find it next to /usr/local/bin/hashcat.

The referenced ${HOME}/.hashcat does not exist on my box after running the app (unsandboxed). Do you have that dir on your Arch Linux machine?

Yes, this directory exists on my box, and contains the potfile, session data, etc.
It seems ${HOME}/.local/share/hashcat is the new location for ${HOME}/.hashcat.

@glitsj16
Copy link
Collaborator

glitsj16 commented Jun 2, 2024

It seems ${HOME}/.local/share/hashcat is the new location for ${HOME}/.hashcat.

Thanks. We'll better keep that in then for backward-compatibility.

@kmk3 kmk3 changed the title private-dev & private-bin break hashcat hashcat fails with private-dev & private-bin Jun 11, 2024
kmk3 pushed a commit to glitsj16/firejail that referenced this issue Jun 11, 2024
kmk3 added a commit to kmk3/firejail that referenced this issue Jun 13, 2024
Apparently hashcat needs access to this device for hardware acceleration
on AMD gpus and `private-dev` currently breaks that (see netblue30#6364).

It seems to be used by the "amdgpu" and "amdkfd" Linux kernel drivers
and as with /dev/dri/renderD128, this file is owned by the "render"
group.

Relevant udev rules from /usr/lib/udev/rules.d/50-udev-default.rules:

    SUBSYSTEM=="drm", KERNEL=="renderD*", GROUP="render", MODE="0666"
    SUBSYSTEM=="kfd", GROUP="render", MODE="0666"
    SUBSYSTEM=="accel", GROUP="render", MODE="0666"

Environment: udev 255.6-1 on Artix Linux.

Reported-by: @schrotthaufen
kmk3 added a commit that referenced this issue Jun 15, 2024
Apparently hashcat needs access to this device for hardware acceleration
on AMD gpus and `private-dev` currently breaks that (see #6364).

It seems to be used by the "amdgpu" and "amdkfd" Linux kernel drivers
and as with /dev/dri/renderD128, this file is owned by the "render"
group.

Relevant udev rules from /usr/lib/udev/rules.d/50-udev-default.rules:

    SUBSYSTEM=="drm", KERNEL=="renderD*", GROUP="render", MODE="0666"
    SUBSYSTEM=="kfd", GROUP="render", MODE="0666"
    SUBSYSTEM=="accel", GROUP="render", MODE="0666"

Environment: udev 255.6-1 on Artix Linux.

Reported-by: @schrotthaufen
@kmk3 kmk3 changed the title hashcat fails with private-dev & private-bin hashcat: failure with private-dev & private-bin Aug 23, 2024
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

3 participants