Rapid7’s 2026 Global Cybersecurity Summit is now available on-demand.Watch sessions.
Rapid7

module

Apache .htaccess Persistence

Disclosed
Dec 1, 1995
Created
Jul 3, 2026

Description

This module writes a persistence payload into an Apache
.htaccess file using mod_cgi. The .htaccess file itself
acts as a CGI shell, executing commands passed via the
query string. Inspired by the htshells project by wireghoul.

Authors

wireghoul
msutovsky-r7
4ravind-b

Platform

Linux,PHP

Architectures

php, cmd

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':


msf > use exploit/linux/persistence/apache_htaccess
msf exploit(apache_htaccess) > show targets
...targets...
msf exploit(apache_htaccess) > set TARGET < target-id >
msf exploit(apache_htaccess) > show options
...show and set options...
msf exploit(apache_htaccess) > exploit

Title
Rapid7 Labs

2026 Global Threat Landscape Report

The predictive window has collapsed. Exploitation follows disclosure in days. See how attackers are accelerating and how to stay ahead.