mirror of
https://github.com/projectdiscovery/nuclei-templates.git
synced 2026-02-07 11:13:20 +08:00
59 lines
1.6 KiB
YAML
59 lines
1.6 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://wiki.devsecopsguides.com/docs/checklists/apache/
|
|
- https://httpd.apache.org/docs/2.4/mod/core.html#options
|
|
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 = "";
|
|
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
|
|
- /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: 490a00463044022024e7ed0a451f189f5f4a8e65a31c5090152c4ef902a23487b6a5568715bd076d02200bdb6084a8cb9a9ec470666affdb26fcfbb41620f189e867551dc4f1900a40de:922c64590222798bb761d5b6d8e72950 |