root@sparrow:~/writeups$ cat easy-phish.md
// writeups
Easy Phish
26 Jul 2019
· 7 min read
Customers of secure-startup.com are getting hit with convincing phishing emails. Instead of chasing the phishing kit itself, the challenge asks a more useful question: why does spoofed mail from this domain sail through in the first place? The answer — and the flag, split in two — is sitting in plain sight in the domain's own SPF and DMARC DNS records.
Challenge overview
| Field | Value |
|---|
| Platform | Hack The Box · Challenge |
| Category | OSINT / DNS |
| Difficulty | Easy |
| State | Retired |
| Target | secure-startup.com |
Attack map
[Recon] secure-startup.com
│
▼
[dig TXT] SPF record → "v=spf1 a mx ?all - HTB{RIP_SPF_Always_2nd"
│
▼
[flag part 1] HTB{RIP_SPF_Always_2nd
│
▼
[dig _dmarc TXT] DMARC record → "v=DMARC1;p=none;_F1ddl3_2_DMARC}"
│
▼
[flag part 2] _F1ddl3_2_DMARC}
│
▼
[FLAG] HTB{RIP_SPF_Always_2nd_F1ddl3_2_DMARC}
Los clientes de secure-startup.com están recibiendo emails de phishing muy convincentes. En vez de perseguir el kit de phishing en sí, el challenge plantea una pregunta más útil: ¿por qué el correo suplantado desde este dominio pasa sin problemas? La respuesta —y la flag, partida en dos— está a la vista en los propios registros DNS SPF y DMARC del dominio.
Ficha del challenge
| Campo | Valor |
|---|
| Plataforma | Hack The Box · Challenge |
| Categoría | OSINT / DNS |
| Dificultad | Easy |
| Estado | Retirado |
| Objetivo | secure-startup.com |
Mapa del ataque
[Recon] secure-startup.com
│
▼
[dig TXT] registro SPF → "v=spf1 a mx ?all - HTB{RIP_SPF_Always_2nd"
│
▼
[flag parte 1] HTB{RIP_SPF_Always_2nd
│
▼
[dig _dmarc TXT] registro DMARC → "v=DMARC1;p=none;_F1ddl3_2_DMARC}"
│
▼
[flag parte 2] _F1ddl3_2_DMARC}
│
▼
[FLAG] HTB{RIP_SPF_Always_2nd_F1ddl3_2_DMARC}
1. Reading the scenario
The prompt isn't "find a vulnerable server," it's a mail-authentication audit: employees at secure-startup.com are being phished with emails that look legitimate. That framing is the actual hint — the weakness isn't a server or a login form, it's how the domain tells the rest of the internet who is allowed to send mail on its behalf. That's exactly what the SPF and DMARC DNS records are for, so the whole challenge lives in dig queries against those two record types.
2. Why SPF and DMARC matter
SPF (Sender Policy Framework) is a TXT record that lists which mail servers/IP ranges are authorized to send email "from" a domain. Receiving mail servers check the SPF record against the sender's IP; if it doesn't match, the message fails SPF. Crucially, SPF's verdict on a failed check is configurable via the qualifier in front of the mechanism: -all (hard fail — reject), ~all (soft fail — accept but flag/quarantine), or ?all (neutral — no real policy at all, the check might as well not exist).
DMARC (Domain-based Message Authentication, Reporting & Conformance) sits on top of SPF and DKIM. It tells receiving servers what to actually do when a message fails alignment — p=none (do nothing, just report), p=quarantine (send to spam), or p=reject (drop it). A domain can have a perfectly formed SPF record and still be trivially spoofable if its DMARC policy is p=none, because p=none means "monitor only, take no enforcement action."
3. Query the SPF record
SPF is published as a plain TXT record on the domain's apex. A standard dig query against the domain, restricted to TXT records, is enough — no zone transfer, no brute force, nothing exotic.
dig secure-startup.com TXT
secure-startup.com. 1800 IN TXT "v=spf1 a mx ?all - HTB{RIP_SPF_Always_2nd"
4. Read the SPF record and pull the first fragment
Parsing the record: v=spf1 declares the SPF version, a and mx authorize the domain's own A and MX hosts to send mail, and ?all is the qualifier for everything else — neutral, i.e. "no opinion." An SPF record ending in ?all provides essentially zero anti-spoofing protection: any server not covered by a/mx is neither explicitly allowed nor rejected, so a filter has nothing solid to act on. That misconfiguration is precisely why the challenge hides the first half of the flag right there, appended after the SPF policy string:
HTB{RIP_SPF_Always_2nd
5. Query the DMARC record
DMARC policies are published as a TXT record on the reserved _dmarc subdomain, not the domain apex. Same tool, different name.
dig _dmarc.secure-startup.com TXT
_dmarc.secure-startup.com. 1232 IN TXT "v=DMARC1;p=none;_F1ddl3_2_DMARC}"
6. Read the DMARC record and pull the second fragment
v=DMARC1 declares the DMARC version, and p=none is the policy applied to messages that fail SPF/DKIM alignment: do nothing, just observe. Combined with the neutral SPF from step 4, this domain has effectively no enforced email-authentication policy at all — SPF doesn't hard-fail unauthorized senders, and DMARC doesn't act even when alignment fails. That's the root cause the challenge is pointing at: this is exactly the kind of domain whose name a phishing kit would spoof, because nothing downstream stops it. The second half of the flag is appended right after the policy:
_F1ddl3_2_DMARC}
7. Assemble the flag
Concatenating the two fragments recovered from the SPF and DMARC TXT records in order gives the complete flag.
HTB{RIP_SPF_Always_2nd_F1ddl3_2_DMARC}
Investigation summary
| Phase | Component | Vulnerability | Impact |
|---|
| DNS enumeration | SPF (TXT record, apex) | Neutral qualifier (?all) — no enforcement for unauthorized senders | Any server can send mail claiming to be from the domain without failing SPF outright; flag part 1 exposed |
| DNS enumeration | DMARC (TXT record, _dmarc subdomain) | Monitor-only policy (p=none) — no quarantine/reject on failed alignment | Spoofed mail that fails authentication is still delivered; flag part 2 exposed |
Lessons learned
- SPF and DMARC records are public DNS data — a simple
dig TXT against the domain and against _dmarc.<domain> reveals the entire email-authentication posture without touching a single mail server. - An SPF qualifier of
?all (or even ~all) is functionally close to having no SPF at all from an anti-spoofing standpoint; only -all enforces a hard fail. - DMARC's
p=none is a monitoring mode, not a defense — it exists so domain owners can collect aggregate reports (rua/ruf tags) before safely moving to p=quarantine and eventually p=reject. - SPF and DMARC alone are not enough: DKIM (cryptographic signing) provides the alignment check that DMARC actually enforces against; a domain missing any one of the three legs of SPF/DKIM/DMARC is meaningfully easier to spoof.
- This is also why real phishing works even against companies that "have security": misconfigured or half-adopted email-authentication records are common, and attackers actively scan for exactly the
?all / p=none combination seen here before spoofing a domain.
1. Leer el escenario
El enunciado no pide "encuentra un servidor vulnerable", es una auditoría de autenticación de correo: los empleados de secure-startup.com están siendo víctimas de phishing con emails que parecen legítimos. Ese planteamiento es la pista real: la debilidad no está en un servidor ni en un formulario de login, sino en cómo el dominio le dice al resto de internet quién tiene permiso para enviar correo en su nombre. Para eso existen exactamente los registros DNS SPF y DMARC, así que todo el challenge se resuelve con consultas dig contra esos dos tipos de registro.
2. Por qué importan SPF y DMARC
SPF (Sender Policy Framework) es un registro TXT que lista qué servidores/rangos de IP están autorizados a enviar correo "de parte" de un dominio. Los servidores receptores comprueban la IP del remitente contra el registro SPF; si no coincide, el mensaje falla SPF. Lo importante es que el veredicto ante un fallo se configura con el calificador que precede al mecanismo: -all (hard fail, rechazar), ~all (soft fail, aceptar pero marcar/cuarentena) o ?all (neutral, sin política real, como si el chequeo no existiera).
DMARC (Domain-based Message Authentication, Reporting & Conformance) se apoya en SPF y DKIM. Le dice al servidor receptor qué hacer de verdad cuando un mensaje falla el alineamiento: p=none (no hacer nada, solo reportar), p=quarantine (mandar a spam) o p=reject (descartar). Un dominio puede tener un SPF perfectamente formado y seguir siendo trivialmente suplantable si su política DMARC es p=none, porque p=none significa "solo monitorizar, sin ninguna acción de aplicación".
3. Consultar el registro SPF
SPF se publica como un registro TXT plano en el ápice del dominio. Una consulta dig estándar contra el dominio, limitada a registros TXT, es suficiente: sin transferencia de zona, sin fuerza bruta, nada exótico.
dig secure-startup.com TXT
secure-startup.com. 1800 IN TXT "v=spf1 a mx ?all - HTB{RIP_SPF_Always_2nd"
Analizando el registro: v=spf1 declara la versión de SPF, a y mx autorizan a los propios hosts A y MX del dominio a enviar correo, y ?all es el calificador para todo lo demás: neutral, es decir, "sin opinión". Un registro SPF que termina en ?all aporta prácticamente cero protección anti-spoofing: cualquier servidor no cubierto por a/mx no queda ni permitido ni rechazado explícitamente, así que un filtro no tiene nada firme sobre lo que actuar. Esa mala configuración es justo por lo que el challenge esconde ahí la primera mitad de la flag, pegada justo después de la política SPF:
HTB{RIP_SPF_Always_2nd
5. Consultar el registro DMARC
Las políticas DMARC se publican como un registro TXT en el subdominio reservado _dmarc, no en el ápice del dominio. Misma herramienta, distinto nombre.
dig _dmarc.secure-startup.com TXT
_dmarc.secure-startup.com. 1232 IN TXT "v=DMARC1;p=none;_F1ddl3_2_DMARC}"
v=DMARC1 declara la versión de DMARC, y p=none es la política aplicada a los mensajes que fallan el alineamiento SPF/DKIM: no hacer nada, solo observar. Combinado con el SPF neutral del paso 4, este dominio no tiene, en la práctica, ninguna política de autenticación de correo aplicada de verdad: SPF no rechaza con hard fail a los remitentes no autorizados, y DMARC no actúa aunque el alineamiento falle. Esa es la causa raíz que señala el challenge: es exactamente el tipo de dominio cuyo nombre suplantaría un kit de phishing, porque nada aguas abajo lo impide. La segunda mitad de la flag va pegada justo después de la política:
_F1ddl3_2_DMARC}
7. Ensamblar la flag
Concatenando en orden los dos fragmentos recuperados de los registros TXT de SPF y DMARC se obtiene la flag completa.
HTB{RIP_SPF_Always_2nd_F1ddl3_2_DMARC}
Resumen de la investigación
| Fase | Componente | Vulnerabilidad | Impacto |
|---|
| Enumeración DNS | SPF (registro TXT, ápice) | Calificador neutral (?all) — sin aplicación para remitentes no autorizados | Cualquier servidor puede enviar correo alegando ser del dominio sin fallar SPF de forma tajante; se expone la parte 1 de la flag |
| Enumeración DNS | DMARC (registro TXT, subdominio _dmarc) | Política de solo monitorización (p=none) — sin cuarentena/rechazo ante fallo de alineamiento | El correo suplantado que falla la autenticación se sigue entregando; se expone la parte 2 de la flag |
Lecciones aprendidas
- Los registros SPF y DMARC son datos DNS públicos: un simple
dig TXT contra el dominio y contra _dmarc.<dominio> revela toda la postura de autenticación de correo sin tocar ni un servidor de mail. - Un calificador SPF
?all (o incluso ~all) equivale, en la práctica de anti-spoofing, a no tener SPF; solo -all aplica un hard fail real. - El
p=none de DMARC es un modo de monitorización, no una defensa: existe para que el dueño del dominio recoja reportes agregados (etiquetas rua/ruf) antes de pasar de forma segura a p=quarantine y, finalmente, a p=reject. - SPF y DMARC solos no bastan: DKIM (firma criptográfica) aporta la comprobación de alineamiento que DMARC realmente exige; a un dominio al que le falte cualquiera de las tres patas —SPF/DKIM/DMARC— es notablemente más fácil suplantarlo.
- Esto también explica por qué el phishing real funciona incluso contra empresas que "tienen seguridad": los registros de autenticación de correo mal configurados o adoptados a medias son habituales, y los atacantes buscan activamente combinaciones como
?all / p=none antes de suplantar un dominio.