nuclei-templates/http/miscellaneous/directory-listing.yaml

102 lines
2.7 KiB
YAML
Raw Permalink Normal View History

2024-05-06 18:04:28 +00:00
id: directory-listing
info:
name: Directory Listing Enabled
author: theMiddle
severity: low
description: Directory Indexing is a web server feature that allows the contents of a directory to be displayed when no index file is present. This can be a security risk as it can expose sensitive files, old backup or unreferenced files.
2024-06-01 06:29:33 +00:00
impact: |
Sensitive files and directories may be exposed to unauthorized users.
remediation: |
Disable directory listing in the web server configuration.
2024-05-06 18:04:28 +00:00
reference:
- https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/02-Configuration_and_Deployment_Management_Testing/04-Review_Old_Backup_and_Unreferenced_Files_for_Sensitive_Information
- https://portswigger.net/kb/issues/00600100_directory-listing
metadata:
max-request: 2
tags: misc,generic,misconfig,fuzz,miscellaneous
2024-05-06 18:04:28 +00:00
flow: |
function target_is_in_scope(url) {
if (url.startsWith(template.http_1_host) || url.startsWith("/")) {
return true;
}
return false;
}
http(1);
if(template.links) {
var path_checked = [];
var paths = [];
2024-05-06 18:28:36 +00:00
2024-05-06 18:04:28 +00:00
for(i=0; i<template.links.length; i++) {
if (target_is_in_scope(template.links[i])) {
2024-05-06 18:28:36 +00:00
2024-05-06 18:04:28 +00:00
var path = template.links[i].replace(template.http_1_host, "");
var path_split = path.split("/");
var path_to_check = "";
2024-05-06 18:28:36 +00:00
2024-05-06 18:04:28 +00:00
for(p in path_split) {
if (path_split[p] != "") {
path_to_check += "/"+path_split[p];
if (!path_checked.includes(path_to_check)) {
path_checked.push(path_to_check);
set("path_to_check", path_to_check);
http(2);
}
}
}
}
}
}
http:
- method: GET
path:
- "{{BaseURL}}"
2024-06-01 06:29:33 +00:00
host-redirects: true
max-redirects: 2
2024-05-06 18:04:28 +00:00
matchers:
2024-06-01 06:29:33 +00:00
- type: dsl
2024-05-06 18:04:28 +00:00
internal: true
2024-06-01 06:29:33 +00:00
dsl:
- contains(header, "text/html")
- status_code_1 == 200
condition: and
2024-05-06 18:04:28 +00:00
extractors:
- type: xpath
name: links
part: body
internal: true
xpath:
- "//*/@href|//*/@src"
- method: GET
path:
- "{{BaseURL}}{{path_to_check}}"
2024-06-01 06:29:33 +00:00
host-redirects: true
max-redirects: 2
2024-05-06 18:04:28 +00:00
matchers-condition: and
matchers:
- type: word
2024-06-01 06:29:33 +00:00
part: body
2024-05-06 18:04:28 +00:00
words:
2024-06-01 06:29:33 +00:00
- "<title>Index of"
2024-06-01 13:41:04 +00:00
case-insensitive: true
2024-06-01 06:29:33 +00:00
2024-05-06 18:04:28 +00:00
- type: word
2024-06-01 06:29:33 +00:00
part: header
2024-05-06 18:04:28 +00:00
words:
2024-06-01 06:29:33 +00:00
- "text/html"
- type: status
status:
- 200
# digest: 4b0a00483046022100bf3abb30efea65d3777450c5714ebe448312e22da383052988a9fa179ea9c5b2022100885960a00ac1e8e5bb00b36bf9ba45cce77466505aac2e70eafbff1efad5f121:922c64590222798bb761d5b6d8e72950