Created
December 6, 2020 02:49
-
-
Save drewmnoel/e7061be883066b7d1065012954ca3077 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Vuln via: scp /etc/passwd temp@localhost:'`touch /tmp/exploit2.sh`/targetfile' | |
set -f | |
set -- $SSH_ORIGINAL_COMMAND | |
# This replicates a really bad filter | |
case "$1" in | |
'ssh*') | |
>&2 echo "Access denied" | |
exit -1 | |
esac | |
# The actual "vuln" is here. -t did not sanitize the contents of $SSH_ORIGINAL_COMMAND | |
# So when we eval it in Bash, it.. evals as Bash and we trigger the backtick expression first. | |
eval $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment