mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1264] Firejail in PHP exec() results in "Error: user .config directory is not owned by the current user" #860
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#860
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tobltobs on GitHub (May 3, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1264
I am trying to jail the command I use in PHPs exec() with firejail.
The commands I tried:
But I always get the following error:
@SkewedZeppelin commented on GitHub (May 3, 2017):
Because the www-data or httpd user doesn't have a home directory. And using firejail in PHP might not be the best idea. You might want to instead wrap your command with escapeshellarg() and wrap your user input with noHTML(). If you haven't, using a framework like Cake or Laravel might be worth looking into, it'll handle all that stuff for you (to an extent). There is also an old program called Skipfish which can detect some common mistakes in your PHP, its worth giving it a run.
Edit: https://www.owasp.org/index.php/PHP_Configuration_Cheat_Sheet Also has lots of useful changes to php.ini that you can use to harden it.
@tobltobs commented on GitHub (May 3, 2017):
I am trying to reduce the risk of feeding user uploads to external programs like ghostscript or imagemagicks convert. Hardening PHP or escaping arguments is already done, but doesn't help with this attack vector.
I am evaluating firejail as a chroot alternative and from the offered feature it looks superior to me. Is there a special reason why using firejail in PHP might not be the best idea?
I could avoid calling firejail by www-data as the processing could also be done by background queue which can use a user with a home. However, I am having problems setting up a firejail for a command with one recursively white-listed directory where changes are persisted. I guess I will have to try harder.
@netblue30 commented on GitHub (May 3, 2017):
I would put all the server in a sandbox. Both apache and nginx are supported.
@tobltobs commented on GitHub (May 3, 2017):
@netblue30 That might be an option. But restricting the calls to external programs could be more strict than the restrictions I could apply to the server. Eg. I could use --net=none for calls to ghostscript, but my PHP scripts require the ability to download a file.