Readable .htaccess file
- CWE 425
- WASC 34
Readable .htaccess files occur when Apache or compatible web server configuration files are publicly accessible. .htaccess files often contain directives for URL rewriting, authentication, access control, and security policies. If exposed, attackers can gain insight into server configuration, directory structures, authentication mechanisms, and potentially sensitive paths. This information can be leveraged to craft targeted attacks, bypass security controls, or identify misconfigurations.
Common patterns leading to readable .htaccess exposure:
- Uploading
.htaccessfiles to web root without restricting public access. - Misconfigured web server rules that serve
.htaccessas regular text files. - Including
.htaccessin version control or deployment pipelines without proper exclusion. - Lack of server directives to hide or deny access to dotfiles.
Impacts:
- Information Disclosure: Reveals server configuration, authentication methods, and sensitive paths.
- Facilitates Targeted Attacks: Attackers can use configuration details to exploit security weaknesses or bypass access controls.
- Increased Attack Surface: Knowledge of rewrite rules, directory structure, or authentication policies aids exploitation.
- Reconnaissance Aid: Exposure helps attackers understand server behavior and design attacks accordingly.
Detection indicators:
.htaccessfiles accessible via direct HTTP requests.- Web server serving
.htaccesscontent instead of denying access. - Security scanners flagging publicly readable dotfiles.
Remediation
Mitigation focuses on restricting access and securing deployment:
Deny Public Access to
.htaccess
Configure the web server to block HTTP requests for.htaccessand other dotfiles.Move Sensitive Configuration Files Outside Web Root
Where feasible, keep configuration files outside of web-accessible directories.Review Deployment Pipelines
Ensure.htaccessfiles are deployed with correct permissions and access restrictions.Use Proper File Permissions
Limit file read access to the web server user and authorized administrators.Monitor and Audit Web Server Access
Track attempts to access.htaccessor other sensitive configuration files.Security Testing
Include checks for dotfiles exposure in penetration testing and automated scans.Educate Developers and Administrators
Ensure team members understand the risks of exposing configuration files publicly.
References
Search Vulnerability
You may also see
- Readable .htaccess file
- apc.php page
- Webalizer script
- phpinfo page
- Apache perl-status Enabled
- Apache server-info Enabled
- Apache server-status Enabled
- JetBrains .idea project directory
- AWStats script
- elmah.axd Detected
- Core dump checker PHP script
- trace.axd Detected
- .DS_Store file
- Macromedia Dreamweaver database scripts
- Help file
- robots.txt Detected
- Sitemap Detected
- crossdomain.xml Detected
- Silverlight Client Access Policy
- Laravel log file
- Code Repository
- Configuration File
- Administration page
- Predictable Resource Location
- Code Repository
- Configuration File
- Administration page