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

SHC binary having problems with jailed user #141

Open
ajmeese7 opened this issue Jun 10, 2022 · 2 comments
Open

SHC binary having problems with jailed user #141

ajmeese7 opened this issue Jun 10, 2022 · 2 comments

Comments

@ajmeese7
Copy link

ajmeese7 commented Jun 10, 2022

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.

terminal screenshot

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!

@Bunnyton
Copy link

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.
изображение

@Bunnyton
Copy link

I solved this problem by using -r flag. But it nothing good

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

2 participants