| Source | Link |
|---|---|
| owasp | www.owasp.org/index.php/SCG_WS_Apache |
# (C) Tenable Network Security, Inc.
#
include("compat.inc");
if (description)
{
script_id(106231);
script_version("1.5");
script_set_attribute(attribute:"plugin_modification_date", value:"2026/04/22");
script_name(english:"Apache .htaccess and .htpasswd Disclosure");
script_summary(english:"Checks if the .ht files can be accessed.");
script_set_attribute(attribute:"synopsis", value:
"The remote web server discloses information via HTTP request.");
script_set_attribute(attribute:"description", value:
"The Apache server does not properly restrict access to .htaccess
and/or .htpasswd files. A remote unauthenticated attacker can
download these files and potentially uncover important information.");
script_set_attribute(attribute:"solution", value:
"Change the Apache configuration to block access to these files.");
script_set_attribute(attribute:"see_also",value:"https://www.owasp.org/index.php/SCG_WS_Apache");
script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:N/A:N");
script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N");
script_set_attribute(attribute:"cvss_score_source", value:"manual");
script_set_attribute(attribute:"cvss_score_rationale", value:"Tenable score for information disclosure.");
script_set_attribute(attribute:"plugin_publication_date", value:"2018/01/22");
script_set_attribute(attribute:"plugin_type", value:"remote");
script_set_attribute(attribute:"cpe", value:"cpe:/a:apache:http_server");
script_set_attribute(attribute:"exploited_by_nessus", value:"true");
script_end_attributes();
script_category(ACT_GATHER_INFO);
script_family(english:"Web Servers");
script_copyright(english:"This script is Copyright (C) 2018-2026 and is owned by Tenable, Inc. or an Affiliate thereof.");
script_dependencies("apache_http_version.nasl");
script_require_ports("Services/www", 80);
script_require_keys("installed_sw/Apache");
exit(0);
}
include('http.inc');
include('install_func.inc');
include('report.inc');
get_install_count(app_name:'Apache', exit_if_zero:TRUE);
var port = get_http_port(default:80);
var install = get_single_install(app_name:'Apache', port:port);
var files = ['/.htaccess', '/.htpasswd'];
var file, res, report_items;
foreach file (files)
{
res = http_send_recv3(method:'GET', port:port, item:file);
if ("200" >< res[0] && !empty_or_null(res[2]) && empty_or_null(get_kb_item("www/no404/" + port)))
{
if ('/.htpasswd' >< file || "</Directory>" >< res[2] || "</IfModule>" >< res[2])
{
report_items = {
'requests' : [build_url(qs:file, port:port)],
'file' : file,
'output' : data_protection::sanitize_user_full_redaction(output:res[2])
};
report::build_and_report(port:port, severity:SECURITY_WARNING, report_items:report_items);
exit(0);
}
}
}
audit(AUDIT_LISTEN_NOT_VULN, "Apache", port, install["version"]);
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation