---
title: "WEB-CMS-013 Drupal Trusted Host Patterns Not Set"
canonical: https://openvapt.com/checks/WEB-CMS-013.html
html: https://openvapt.com/checks/WEB-CMS-013.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-CMS-013 Drupal Trusted Host Patterns Not Set

Checks Drupal settings.php for the trusted_host_patterns setting.

- 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-644, CWE-346
- OWASP Top 10 2021: A05:2021
- OWASP ASVS 4.0.3: 14.4.1
- OWASP WSTG v4.2: WSTG-INPV-17
- NIST SP 800-53 Rev. 5: CM-6, SI-10

## Why It Matters

Without trusted_host_patterns Drupal builds absolute links, including password reset links, from whatever Host header the request carries. An attacker who sends a crafted Host header can poison caches and redirect reset links to a domain they control.

## How It Detects

Reads each sites/*/settings.php found through the web roots (comments removed) and fails when $settings['trusted_host_patterns'] is not assigned.

## How to Fix

Add to settings.php:  $settings['trusted_host_patterns'] = ['^www\.example\.com$', '^example\.com$'];  then clear caches (drush cr). The status report page should no longer warn about trusted hosts.

## How to Verify

```
drush status-report | grep -i 'trusted host'
```

## Learn the Theory

- [P6 Information Exposure and Misconfiguration](https://openvapt.com/academy/p6.md)
- [P14 CMS Hardening in Depth: WordPress, Joomla and Drupal](https://openvapt.com/academy/p14.md)
- [A6 Application Framework and CMS Configuration](https://openvapt.com/academy/a6.md)

## References

- [Drupal.org, Trusted Host settings](https://www.drupal.org/docs/getting-started/installing-drupal/trusted-host-settings)
- [OWASP WSTG-INPV-17, Testing for Host Header Injection](https://wstg.owasp.org/v4.2/4-Web_Application_Security_Testing/07-Input_Validation_Testing/17-Testing_for_Host_Header_Injection/)

## Source Code

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

Run it: `openvapt scan --only WEB-CMS-013`. Read it offline: `openvapt explain WEB-CMS-013`.

---

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-CMS-013.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
