mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-02-10 12:43:29 +08:00
57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
id: disable-directory-listing
|
|
|
|
info:
|
|
name: Disable Directory Listing in Apache2
|
|
author: pussycat0x
|
|
severity: medium
|
|
description: |
|
|
Directory listing should be disabled to prevent unauthorized users from browsing server directories.
|
|
remediation: |
|
|
Add 'Options -Indexes' in the Apache configuration file or .htaccess file.
|
|
reference:
|
|
- https://httpd.apache.org/docs/2.4/mod/core.html#options
|
|
metadata:
|
|
verified: true
|
|
tags: audit,config,auth,apache
|
|
|
|
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 = "";
|
|
const regex = /\bOptions\s+Indexes\b(?!\s+FollowSymLinks)/;
|
|
if (ApacheConfig.includes("<Directory") && regex.test(ApacheConfig)) {
|
|
result += "Disable directory listing";
|
|
} else {
|
|
exit();
|
|
}
|
|
result
|
|
|
|
args:
|
|
Host: "{{Host}}"
|
|
Port: "22"
|
|
User: "{{usernames}}"
|
|
Pass: "{{passwords}}"
|
|
Code: cat {{path}}
|
|
|
|
payloads:
|
|
path:
|
|
- /etc/apache2/apache2.conf #apache2 Debian
|
|
- /etc/httpd/conf/httpd.conf #apache RHEL
|
|
- /etc/httpd/conf.d #apache Virtual Host
|
|
- /usr/local/etc/httpd/httpd.conf #macos
|
|
|
|
matchers:
|
|
- type: dsl
|
|
dsl:
|
|
- "success == true"
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- response |