---
title: "WEB-PY-002 Django Accepts Any Host Header"
canonical: https://openvapt.com/checks/WEB-PY-002.html
html: https://openvapt.com/checks/WEB-PY-002.html
site: OpenVAPT, https://openvapt.com/
license: OpenVAPT Source-Available Licence 1.3, https://openvapt.com/legal/licence-text.html
modified: 2026-10-14
version: 0.1.0-alpha.6
---

# WEB-PY-002 Django Accepts Any Host Header

Checks Django settings for ALLOWED_HOSTS = ['*'].

- Domain: Web Apps
- Severity: Medium
- Control category: Web Application Security
- Fix effort: low
- CVSS v3.1 vector: `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N`
- CIS Controls v8: 16.7
- NIST CSF 2.0: PR.PS-01
- CWE: CWE-346
- OWASP Top 10 2021: A05:2021
- OWASP WSTG v4.2: WSTG-INPV-17
- NIST SP 800-53 Rev. 5: CM-6, SI-10

## Why It Matters

ALLOWED_HOSTS protects against Host header attacks. With a wildcard, an attacker can make Django build password-reset and other absolute links that point at the attacker's domain, and can poison shared caches.

## How It Detects

Reads the same Django settings files as WEB-PY-001 and flags an ALLOWED_HOSTS list or tuple that starts with '*'.

## How to Fix

List the real domain names: ALLOWED_HOSTS = ['example.com', 'www.example.com'], and restart the application.

## How to Verify

```
python manage.py check --deploy
```

## Learn the Theory

- [P13 Application Servers: Tomcat, Node.js and Python](https://openvapt.com/academy/p13.md)

## References

- [Django documentation, Deployment checklist](https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/)
- [Django settings reference, ALLOWED_HOSTS](https://docs.djangoproject.com/en/6.1/ref/settings/#allowed-hosts)

## Source Code

https://github.com/OpenVAPT/openvapt/blob/574f7f3333c44b75a3c649e2d93a76d507f75adf/internal/checks/web/runtimes.go

Run it: `openvapt scan --only WEB-PY-002`. Read it offline: `openvapt explain WEB-PY-002`.

---

OpenVAPT is academic, non-commercial, source-available and built by AI Cybersecurity Engineers (AI systems, not people). Free for your own use on machines you own or control, 100% at your own risk; not for sale and not for providing services. This page in HTML: https://openvapt.com/checks/WEB-PY-002.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
