Skip to content

Commit cd46c8b

Browse files
committed
added Azure and GCP pentesting
1 parent bda6807 commit cd46c8b

File tree

8 files changed

+202
-86
lines changed

8 files changed

+202
-86
lines changed

src/exploit/cloud/_data.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
category1: cloud
2+
related_menus:
3+
- title: Others
4+
id: others

src/exploit/web/cloud/aws-pentesting.md renamed to src/exploit/cloud/aws-pentesting.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
title: AWS (Amazon Web Services) Pentesting
33
description: AWS (Amazon Web Services) provide on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis.
44
tags:
5-
- AWS
6-
- Web
5+
- Cloud
76
refs:
8-
date: 2022-11-22
7+
date: 2024-12-18
98
draft: false
109
---
1110

@@ -23,28 +22,62 @@ arn:aws:<service>:<region>:<account_id>:<resource_type>/<resource_name>
2322
```sh
2423
# Add credentials
2524
# This will add entries to .aws/config or .aws/credentials in user's home directory.
26-
# <profile-name> is arbitrary.
25+
# <profile-name> is arbitrary name.
2726
aws configure --profile <profile-name>
28-
2927
# List credentials
3028
aws configure list --profile <profile-name>
3129

30+
# List user policies
31+
aws iam list-user-policies --user-name <username>
32+
# Get a specified user policy
33+
aws iam get-user-policy --user-name <username> --policy-name <policy>
3234

3335
# Find the account id belonging to an access key (access key starts with "AKIA")
3436
aws sts get-access-key-info --access-key-id AKIAQ31B...
35-
3637
# Determin the username the access key you're using belogns to
3738
aws sts get-caller-identity --profile <profile-name>
3839

3940
# List all EC2 instances running in an account
4041
aws ec2 describe-instances --output text --profile <profile-name>
41-
4242
# List all EC2 instances running in an account in a dirrerent region
4343
aws ec2 describe-instances --output text --region us-east-1 --profile <profile-name>
4444
```
4545

4646
<br />
4747

48+
## Assume Role
49+
50+
Using "Assume Role" we can temporarily take on permissions associated with another role to access resources or perform tasks in a controlled and secure manner. Attackers may abuse this feature to escalate privileges.
51+
52+
### 1. Get Credentials and Session Token
53+
54+
At first, get the value of `SessionToken` with the `assume-role` command:
55+
56+
```bash
57+
aws sts assume-role --role-arn <arn> --role-session-name <session>
58+
```
59+
60+
### 2. Configure Credentials and Session Token
61+
62+
Now we can set the values obtained above to our configuration.
63+
64+
```bash
65+
aws configure
66+
# AWS Access Key ID: "<AccessKeyId>"
67+
# AWS Secret Access Key: "<SecretAccessKey>"
68+
aws configure set aws_session_token <SessionToken>
69+
```
70+
71+
### 3. Verify Role
72+
73+
To check if we’ve configured properly, run `get-caller-identity`:
74+
75+
```bash
76+
aws sts get-caller-identity
77+
```
78+
79+
<br />
80+
4881
## Amazon S3
4982

5083
A public cloud storage resource available in Amazon Web Services (AWS) Simple Storage Service (S3), an object storage offering.

src/exploit/cloud/azure-pentesting.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Azure Pentesting
3+
description:
4+
tags:
5+
- Cloud
6+
refs:
7+
- https://pwnedlabs.io/labs/azure-blob-container-to-initial-access
8+
date: 2024-12-18
9+
draft: false
10+
---
11+
12+
## Install Azure CLI
13+
14+
To pentesting Azure, we need to install Azure CLI on our machine. See https://learn.microsoft.com/en-us/cli/azure/install-azure-cli for details.
15+
16+
Additionally, the `Az` PowerShell module is useful.
17+
18+
```bash
19+
Import-Module -Name Az
20+
```
21+
22+
<br />
23+
24+
## Azure Blob Storage
25+
26+
Azure Blob Storage stores static files in the URL: `https://<account>.blob.core.windows.net/`.
27+
We can enumerate the target storage by accessing the following URLs in browser:
28+
29+
```bash
30+
# Enumerate detailed information for the storage
31+
https://<account>.blob.core.windows.net/<container>?restype=container&comp=list
32+
33+
# Enumerate directories
34+
https://<account>.blob.core.windows.net/<container>?restype=container&comp=list&delimiter=%2F
35+
36+
# Enumerate version information
37+
https://<account>.blob.core.windows.net/<container>?restype=container&comp=list&include=versions
38+
# Specify version
39+
https://<account>.blob.core.windows.net/<container>/example.txt?versionid=2021-09-20T12:34:56.789Z
40+
```
41+
42+
<br />
43+
44+
## Active Directory
45+
46+
Resources: [Microsoft Docs](https://learn.microsoft.com/en-us/powershell/module/az.resources/get-azaduser?view=azps-13.0.0)
47+
48+
```bash
49+
# Get signin user
50+
Get-AzADUser -SignedIn
51+
52+
# List users
53+
Get-AzADUser -First 10 -Select 'City' -AppendSelected
54+
```

src/exploit/cloud/gcp-pentesting.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: GCP (Google Cloud Platform) Pentesting
3+
description:
4+
tags:
5+
- Cloud
6+
refs:
7+
- https://pwnedlabs.io/labs/reveal-hidden-files-in-google-storage
8+
date: 2024-12-18
9+
draft: false
10+
---
11+
12+
## Install Google Cloud CLI
13+
14+
Before pentesting GCP, we need to install a dedicated CLI tool. See [the installation guide](https://cloud.google.com/sdk/docs/install) for details.
15+
After installed, login with your Google credential:
16+
17+
```bash
18+
gcloud auth login
19+
```
20+
21+
<br />
22+
23+
## Google Storage
24+
25+
Google Storage allows users to store static files in the URL: `https://storage.googleapis.com/<bucket-name>/`.
26+
We can enumerate the target storage as below:
27+
28+
```bash
29+
# Enumerate accessible directories/files from outside.
30+
fuzz -u https://storage.googleapis.com/<bucket-name>/FUZZ -w wordlist.txt -fc 403
31+
32+
# Display directories/files
33+
gsutil ls gs://<bucket-name>/example/
34+
35+
# Download a file
36+
gsutil cp gs://<bucket-name>/example.txt
37+
38+
# Get information for the bucket
39+
gsutil stat gs://<bucket-name>/index.html
40+
```
Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
---
22
title: Crack 7z Password
3-
description:
3+
description: If a 7z file is protected with password, we can crack the password.
44
tags:
55
- Archive
66
refs:
7-
date: 2023-11-28
7+
date: 2024-12-18
88
draft: false
99
---
1010

1111
## Crack
1212

13-
```bash
13+
### 1. Convert to Hash
14+
15+
First we need to convert the `.7z` file to hash.
16+
17+
```sh
1418
7z2john example.7z > hash.txt
1519
# or
1620
/usr/share/john/7z2john.pl example.7z > hash.txt
17-
18-
john --wordlist=wordlist.txt hash.txt
1921
```
2022

2123
If we got the error “`Can't locate Compress/Raw/Lzma.pm in @INC`...”, we need to install `libcompress-raw-lzma-perl` package so try:
2224

2325
```bash
2426
sudo apt install libcompress-raw-lzma-perl
2527
```
28+
29+
### 2. Crack the Hash
30+
31+
Now we can crack the hash with one of the commands below:
32+
33+
```sh
34+
john --wordlist=wordlist.txt hash.txt
35+
# or
36+
hashcat -m 11600 hash.txt wordlist.txt
37+
```

src/exploit/network/wifi/wifi-hacking.md

Lines changed: 47 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,61 @@ description:
44
tags:
55
- Network
66
refs:
7-
date: 2024-06-19
7+
date: 2024-12-18
88
draft: false
99
---
1010

11-
## Investigation
12-
13-
### Online Tools
14-
15-
- **[WiGLE](https://wigle.net/)**
16-
17-
Wireless Network Mapping. If you have the BSSID, you can get the location.
18-
You need to create an account to use the advanced search.
19-
20-
### Check Status
21-
22-
- **Retrieve the Device IP Address**
23-
24-
```sh
25-
# IP address
26-
ip addr
27-
# IP address - Show the specific interface only
28-
ip addr show eth0
29-
ip addr show eth1
30-
ip addr show tun0
31-
32-
# IPv4 only
33-
ip -4 addr
34-
# IPv6 only
35-
ip -6 addr
36-
37-
# Static route
38-
ip route
39-
```
40-
41-
- **Delete Network Interfaces From Your Devices**
42-
43-
```sh
44-
ip link delete docker0
45-
```
11+
## Enumeration
12+
13+
```sh
14+
# IP addresses
15+
ip addr
16+
# specific interface
17+
ip addr show eth0
18+
ip addr show eth1
19+
ip addr show tun0
20+
# IPv4/6 only
21+
ip -4 addr
22+
ip -6 addr
23+
# Static route
24+
ip route
25+
26+
# Get the currently connected WiFi router's IP address (see the 'Default gateway' line in the output)
27+
ipconfig
28+
29+
# Find any wireless devices
30+
iw dev
31+
# Display information of the specified device
32+
iw dev <interface> info
33+
# Scan wifi networks nearby the specified device
34+
iw dev <interface> scan
35+
36+
# Find another computer's IP address/MAC address on the network
37+
arp -av
38+
39+
# Get public IP address
40+
curl https://api.ipify.org
41+
```
4642

47-
- **Find Current WiFi IP Address**
48-
49-
We can get the ip adress of the WiFi that we’re currently connecting by checking a default gateway in results of `ipconfig` command.
50-
51-
```bash
52-
ipconfig
43+
### Using WiGLE
5344

54-
# Outputs
55-
56-
...
57-
58-
Default gateway . . . . . : 192.168.1.1
59-
```
45+
If BSSIDs found, we can find the location for devices using [WiGLE](https://wigle.net/).
6046

61-
- **Find Another Computer's IP Address/MAC Address on Network**
47+
To find BSSID From SSID using WiGLE:
6248

63-
```sh
64-
arp -av
65-
```
66-
67-
- **Get Public IP Address**
49+
1. Access to WiGLE and login.
50+
2. Go to View → Advanced Search.
51+
3. Open the General Search tab.
52+
4. Input the SSID in the SSID/Network Name.
53+
5. Check the result.
6854

69-
We can get our public ip address from command line as below.
55+
<br />
7056

71-
```bash
72-
curl https://api.ipify.org
73-
```
57+
## Delete Network Interfaces From Your Devices
7458

75-
Alternatively, we can get the public ip online like https://www.whatismyip.com/.
59+
```sh
60+
ip link delete <iterface>
61+
```
7662

7763
<br />
7864

@@ -101,16 +87,6 @@ aircrack-ng example.cap -w wordlist.txt
10187

10288
<br />
10389

104-
## Find BSSID From SSID
105-
106-
1. Access to WiGLE and login.
107-
2. Go to View → Advanced Search.
108-
3. Open the General Search tab.
109-
4. Input the SSID in the SSID/Network Name.
110-
5. Check the result.
111-
112-
<br />
113-
11490
## MAC Address Spoofing
11591

11692
First of all, you need to use network adapter which has monitor mode on your machine.
@@ -188,11 +164,11 @@ sudo Freeway -i wlan1 -a deauth
188164

189165
## Other Useful Tools
190166

191-
- **[Bettercap](https://www.bettercap.org/)**
167+
- [Bettercap](https://www.bettercap.org/)
192168

193169
The Swiss Army knife for 802.11, BLE, IPv4 and IPv6 networks reconnaissance and MITM attacks.
194170

195-
- **[OUI Standards](https://standards-oui.ieee.org/oui/oui.txt)**
171+
- [OUI Standards](https://standards-oui.ieee.org/oui/oui.txt)
196172

197173
List of MAC OUI (Organizationally Unique Identifier). You can get the information from the BSSID.
198174

src/exploit/web/_data.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ related_menus:
1414
id: template-engine
1515
- title: API
1616
id: api
17-
- title: Cloud
18-
id: cloud
1917
- title: Microsoft
2018
id: microsoft
2119
- title: Tool

src/exploit/web/cloud/_data.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)