mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-02-02 08:43:27 +08:00
58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
id: disable-server-header
|
|
|
|
info:
|
|
name: Disable Server Header in Apache2
|
|
author: pussycat0x
|
|
severity: medium
|
|
description: |
|
|
Ensures that 'ServerTokens Prod' and 'ServerSignature Off' are correctly set in Apache to prevent server information leakage.
|
|
remediation: |
|
|
Set 'ServerTokens Prod' and 'ServerSignature Off' in Apache configuration and restart the service.
|
|
reference:
|
|
- https://wiki.devsecopsguides.com/docs/checklists/apache/
|
|
- https://httpd.apache.org/docs/2.4/mod/core.html#serversignature
|
|
metadata:
|
|
verified: true
|
|
tags: audit,config,auth,apache,hardening
|
|
|
|
javascript:
|
|
- pre-condition: |
|
|
isPortOpen(Host,Port);
|
|
code: |
|
|
var m = require("nuclei/ssh");
|
|
var c = m.SSHClient();
|
|
c.Connect(Host,Port,User,Pass);
|
|
const ApacheConfig = c.Run(Code)
|
|
ApacheConfig
|
|
let result = "";
|
|
if (ApacheConfig.includes("<Directory") && !ApacheConfig.includes("ServerTokens Prod") && !ApacheConfig.includes("ServerSignature Off")) {
|
|
result += "Disable HTTP Headers";
|
|
} else {
|
|
exit();
|
|
}
|
|
result
|
|
|
|
args:
|
|
Host: "{{Host}}"
|
|
Port: "22"
|
|
User: "{{usernames}}"
|
|
Pass: "{{passwords}}"
|
|
Code: cat {{path}}
|
|
|
|
payloads:
|
|
path:
|
|
- /etc/apache2/apache2.conf
|
|
- /etc/httpd/conf/httpd.conf
|
|
- /etc/httpd/conf.d
|
|
- /usr/local/etc/httpd/httpd.conf
|
|
|
|
matchers:
|
|
- type: dsl
|
|
dsl:
|
|
- "success == true"
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- response
|
|
# digest: 4b0a00483046022100ab934cdfa66e4770066abd76813244cdd313ab2df4843cde04b2293c3e03a1a8022100db4afb5a43909096bdb1594c955383f2d98a5a0a3f61b97590775447157377d7:922c64590222798bb761d5b6d8e72950 |