$ cat owasp/a02.md
A02:2025
Security Misconfiguration
The code is fine. The server, framework or cloud settings around it are not.
## 1 · why it happens
Defaults are built for getting started, not for production: debug mode on, sample pages installed, directory listing enabled, verbose errors, every HTTP method allowed.
This is the category OSINT finds best, because misconfiguration is visible from outside: an exposed .git folder, a staging server on a forgotten subdomain, a Swagger page, a version banner. XXE also lives here - it is an XML parser with dangerous features left on.
# JavaScript
const app = express();
app.use(express.static('.')); // serves .git, .env, everything
app.use((err, req, res, next) => {
res.status(500).send(err.stack); // stack trace to the world
});const app = express();
app.disable('x-powered-by');
app.use(helmet()); // sane security headers
app.use(express.static('public', { dotfiles: 'deny' }));
app.use((err, req, res, next) => {
logger.error(err);
res.status(500).json({ error: 'Internal error' });
});# C#
var settings = new XmlReaderSettings
{
DtdProcessing = DtdProcessing.Parse, // enables XXE
XmlResolver = new XmlUrlResolver()
};
// and in Program.cs:
app.UseDeveloperExceptionPage(); // in productionvar settings = new XmlReaderSettings
{
DtdProcessing = DtdProcessing.Prohibit,
XmlResolver = null
};
// Program.cs
if (app.Environment.IsDevelopment())
app.UseDeveloperExceptionPage();
else
app.UseExceptionHandler("/error");## 2 · how attackers find it from outside
| public source | what it tells them |
|---|---|
| Certificate transparency (crt.name) | staging., dev., old-admin. subdomains - usually configured with less care than production. |
| Shodan / Censys | Open admin ports, default pages and exact server versions, already indexed. |
| Search engine dorks | Indexed directory listings, .env files and error pages. |
| HTTP response headers | Server: nginx/1.18.0, X-Powered-By - the exact version to look up in a CVE database. |
→ all OSINT sources · run them on yourself
## 3 · how it's abused
⚠ Recon your own assets, or targets you have written permission to test. Passive OSINT reads public data, but using it to target someone else's systems can still be illegal or against their terms. Examples on this site use example.com placeholders.
GET /.git/HEADIf this returns "ref: refs/heads/main", the whole source code can be downloaded.
GET /.envFramework config file with database passwords and API keys.
GET /swagger/index.htmlA full, clickable map of your API - handy for attackers too.
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo>XXE: asks the XML parser to read a local file and put it in the response.
Payload examples adapted from PayloadsAllTheThings (MIT, © Swissky). Full lists:Insecure Source Code Management · Insecure Management Interface · XXE Injection · Web Cache Deception · Reverse Proxy Misconfigurations
## 4 · fix
- Same hardened config for every environment - staging gets attacked too.
- Turn off debug mode, directory listing, sample apps and unused HTTP methods.
- Remove version headers (server_tokens off, disable X-Powered-By).
- Disable DTDs / external entities in every XML parser.
- Keep an inventory of your subdomains and delete the ones you no longer use.
## 5 · detect
subfinder
Fast passive subdomain discovery from many public sources.
map the surfacehttpx
Which of your subdomains are alive, and what is running on them?
authorized targets onlytest itArtemis
Modular vulnerability scanner with automatic reports, by CERT Polska.
authorized targets onlyfix at sourceCheckov
Finds misconfigurations in Terraform, Kubernetes, Dockerfiles and CI configs.
fix at sourceKICS
Infrastructure-as-code scanner with thousands of queries.
Official description: OWASP A02:2025 Security Misconfiguration