• Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

These are tools we released with our 2020 defcon/blackhat talk https://www.youtube.com/watch?v=Ml09R38jpok

gcploit

This repo has the code for the gcploit exploit framework, the BFS search tool meant for defensive threat models, a mock org simulator, as well as stack driver queries that profile the gcploit tool.

If you haven't seen our talk yet, it's available here https://www.youtube.com/watch?v=Ml09R38jpok

BFS Search

To start you'll need the cloudasset.assets.analyzeIamPolicy permission at the organization level to use this tool.

Next do a gcloud auth login an complete the flow.

Finally run the tool python bfs.py --org_id <orgId> --source <serviceAccountEmail>

This will print the results of the BFS from your starting service account inside your org

Note bindings that come from other orgs won't be included here

Mock Graph

To generate a mock graph, from the dummyOrg directory, run python mockgraph.py and copy nodes.json edges.json and innocent_edges.json into animated-bfs and then serve the content in the animated-bfs directory with python -m http.server

Gcploit

Gcploit is a proof of concept, as-is framework for exploiting GCP. It includes some (not all) of the exploits we talked about in our talk.

These include:

actAs
dataproc

As of this moment, we don't have the following exploits implmented yet:

tokenCreator
dataflow
composer
compute admin
dataprep
google managed service account privesc (ie cloudbuild)
datafusion
cloudbuild
actAs with VM's instead of GCF

To use the tool, docker is required.

First create an alias for the tool:

To mount in a base identity, authenticate to the base identity, and then pass in your gcloud credentials to the tool. Your credentials are typically found in $HOME/.config, so below is an example alias

alias gcploit="docker run -v $(pwd)/db:/db -v $HOME/.config:/root/.config -it --rm dxa4481/gcploit python main.py"

Now you should be able to run:

gcploit --list

If everything goes well you'll see no output

now you can try an exploit out:

gcploit --exploit actas --project <project_name> --target_sa all

This exploit requires the base identity have actAs and functionCreator on the target project. In the future support for this without the functionCreator permission may be added (ie computeAdmin instead to use VM's instead of Functions)

Now if you run gcloud --list if all went well you should see a bunch of new service accounts you took control of through actAs

To interact with one of these try:

gcploit --gcloud "projects list" --source <8charname>

now you can add the --source flag to your exploits and try something like

gcploit --exploit actas --project <new_project_name> --source <8charname> --target_sa all

The use of a Proxy

Note often times oauth creds are all we get from these exploits, not json creds. To use these we spin up a proxy service in the function and live replace the oauth creds on outbound requests. This was done in a hacky way, and as a result it involves setting a proxy variable and unsetting a proxy variable in your .config. If the tool errors out or is killed mid command it's possible these may persist, and to clean it up you can run:

gcloud config unset proxy/port
gcloud config unset proxy/type
gcloud config unset proxy/address
gcloud config unset core/custom_ca_certs_file

Stack Driver Queries

The following Stack Driver query should give you insight into if this tool is being used against you in your environment:

protoPayload.request.function.timeout="539s"

The following examples demonstrate how to query logs using the gcloud CLI tool. https://cloud.google.com/sdk/gcloud/reference/logging/read

Query logs across an organization:

gcloud logging read $STACK_DRIVER_FILTER --organization=$ORGANIZATION_ID --format json

Query logs in a specific folder:

gcloud logging read $STACK_DRIVER_FILTER --folder=$FOLDER_ID --format json

Query logs in a specific project:

gcloud logging read $STACK_DRIVER_FILTER --project=$PROJECT_ID --format json

More Repositories

1

Pastejacking

A demo of overriding what's in a person's clipboard
HTML
1,419
star
2

WPA2-HalfHandshake-Crack

This is a POC to show it is possible to capture enough of a handshake with a user from a fake AP to crack a WPA2 network without knowing the passphrase of the actual AP.
Python
545
star
3

cssInjection

Stealing CSRF tokens with CSS injection (without iFrames)
HTML
306
star
4

Snapper

A security tool for grabbing screenshots of many web hosts
Python
290
star
5

truffleHogRegexes

These are the regexes that power truffleHog
Python
192
star
6

XSSJacking

Abusing Self-XSS and Clickjacking to trigger XSS
HTML
126
star
7

windowHijacking

A demo of altering an opened tab after a timer
HTML
125
star
8

AttackingAndDefendingTheGCPMetadataAPI

This repo gives an overview of some GCP metadata API attack and defend patterns
78
star
9

Damn-Vulnerable-Redis-Container

An example of obtaining RCE via Redis and CSRF
HTML
74
star
10

XSSOauthPersistence

Maintaining account persistence via XSS and Oauth
JavaScript
69
star
11

whatsinmyredis

A CSRF demonstration of stealing local Redis data, and encrypting all Redis instances on a local network
CSS
53
star
12

inputProtectionShield

Eagle
42
star
13

CORS

JSON API's Are Automatically Protected Against CSRF, And Google Almost Took It Away.
34
star
14

CSRF-PoC-Genorator

This is a simple CSRF Proof of Concept generator that supports multiple form encodings and methods
HTML
28
star
15

mimikittenz4Linux

Steals cleartext passwords from webservices, by reading the memory of browsers
Python
27
star
16

santaHog

Scans packages in npm and pypi for secrets
Python
27
star
17

clientHashing

A demonstration of secure hashing done client side
JavaScript
22
star
18

bygonessl

A tool to discover bygonessl vulnerabilities using the facebook API
Python
19
star
19

logger

Simple javascript logging of fingerprint, IP address and user agent
JavaScript
17
star
20

SmartHealthCardViewer

Smart Health Card Viewer, view your California Smart Health Card Vaccination record
JavaScript
8
star
21

BitRush

An open source project for bitcoin mining on an FPGA
VHDL
7
star
22

domainAbandonedDetector

Detects abandoned domains referenced in HTML
Python
7
star
23

dxa4481.github.io

This is my resume, in HTML/CSS
Python
6
star
24

JayPi

Translating JTAGENUM to Python for the Raspberry Pi
Python
6
star
25

redirect_demo

HTML
6
star
26

gpsIoTTracker

This simple python module takes GPS locations of a moving object, and measured signal strengths of an IoT object and uses trilateration and the method of least squares to solve for the location of the object
Python
5
star
27

Veyebrations

We are creating a system that translates measured distances of physical objects into vibrations to assist the blind
Eagle
4
star
28

JohnWilliams

JavaScript
4
star
29

coolSVGXSS

simple demo of XSS in an SVG
HTML
4
star
30

security_reports

A simple template that can be used to deliver security reports either for bug bounties, internal reports, or consultancy work
HTML
4
star
31

penguin

A restful single page app tool sharing application
Python
3
star
32

VibrationAPI

An example of the HTML5 vibration API
HTML
2
star
33

Tutorials

Learning new things
JavaScript
2
star
34

dotGitFinder

JavaScript
2
star
35

HIVStats

This application makes HIV statistics very accessible
HTML
2
star
36

log_handler

The backend log handler for logger.io
JavaScript
2
star
37

SocialEngineeringPresentation

A simple presentation on social engineering
HTML
2
star
38

SoundMaker

This uses the open hardware provided by arduino to modify an arduino PCB into making a sound board
Eagle
1
star
39

fingerprint-page-count

Counts how many times a user has viewed a page based on his browser's fingerprint
JavaScript
1
star
40

blog

HTML
1
star
41

SeriousApiarist

Controlled builds, tests, static analysis, releases, and deploys with validation and 2FA and live streaming to your CI
Go
1
star
42

serviceworkerCSRFLogout

HTML
1
star
43

insecureLamp

a very simple insecure web application designed to turn a lamp on and off
Python
1
star
44

serverConfigs

The server configuration files for security.love and e-q.pw
1
star
45

FingerprintPressure

This simple demo shows given an image of a fingerprint, you can determine how hard the person was pushing down
Python
1
star
46

AccelerometerAPI

A brief demonstration showing browsers can access a device's accelerator data without promoting a user. This app shows the total acceleration vector magnitude
HTML
1
star
47

CORS-pdf

This is a simple demo that shows you can host a PDF cross origin in chrome, and track a user's interaction with the PDF with the default chrome PDF viewer.
HTML
1
star