shc
shc copied to clipboard
SHC binary having problems with jailed user
Hey there, I am trying to use an shc
binary for a chrooted user on my system and I am running into an issue that has had me stumped for several days.
Whenever I run the compiled binary as a non-jailed user, I have no problems at all and it does what it is supposed to do. But when I run the script as the jailed user, it just outputs gibberish to the terminal and doesn't run the code inside the script. I have chmod
'd the binaries to make them executable and chown
'd them so the jailed user definitely has the permission to execute the script and the commands contained within.
When I run the commands within the compiled shell script manually, the user can do so without issues. But once it is converted into a binary the problem arises. Below is a simplified example of what I am attempting to accomplish:
#!/bin/bash
PASSWORD="passaword_here"
if [ -z $1 ]; then
# Requires a password to run.
echo "Usage: ./zork3.sh [password]"
echo "Or if converted to binary form: zork3 [password]"
exit 1
elif [ "$1" = "$PASSWORD" ]; then
# Runs Zork III if the password is correct.
frotz ./COMPILED/zork3.z3
else
# If the password is incorrect, tell the user.
echo "That is not the correct password!"
exit 1
fi
The script I run to generate the binaries from the shell scripts:
#!/bin/bash
ls -A | grep -E "zork.\.sh" | while read -r file; do
echo "Compiling $file..."
sudo shc -U -f "$file" -o "${file%.*}"
done
Any assistance in resolving this would be appreciated, thanks!
I have this problem too. I executed shc for my commands in /usr/bin/ in docker system. This work amazing, and this commands is executable before i start this docker with new changes again.
I solved this problem by using -r flag. But it nothing good