Skip to content

Commit 8caa2a1

Browse files
authored
Merge pull request #132 from 0xn3va/develop
Small updates
2 parents 461a53e + 144183e commit 8caa2a1

File tree

13 files changed

+838
-605
lines changed

13 files changed

+838
-605
lines changed

Container/Escaping/cve-list.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,20 @@
1919

2020
| CVE | Title | Required capabilities | References |
2121
| --- | --- | --- | --- |
22+
| [CVE-2022-47939](https://nvd.nist.gov/vuln/detail/CVE-2022-47939) | A use-after-free vulnerability in fs/ksmbd/smb2pdu.c | `?` | <p>> [Linux Kernel ksmbd Use-After-Free Remote Code Execution Vulnerability](https://www.zerodayinitiative.com/advisories/ZDI-22-1690/)</p> |
23+
| [CVE-2022-34918](https://nvd.nist.gov/vuln/detail/CVE-2022-34918) | A type confusion bug in nft_set_elem_init that leads to a buffer overflow. | CAP_NET_ADMIN | <p>> [CVE-2022-34918 A crack in the Linux firewall](https://randorisec.fr/crack-linux-firewall/)</p><p>> [Github: randorisec/CVE-2022-34918-LPE-PoC](https://github.com/randorisec/CVE-2022-34918-LPE-PoC)</p> |
24+
| [CVE-2022-32250](https://nvd.nist.gov/vuln/detail/CVE-2022-32250) | A use-after-free vulnerability in the Netfilter subsystem | `?` | <p>> [Linux Kernel Exploit (CVE-2022-32250) with mqueue](https://blog.theori.io/research/CVE-2022-32250-linux-kernel-lpe-2022/)</p><p>> [SETTLERS OF NETLINK: Exploiting a limited UAF in nf_tables (CVE-2022-32250)](https://research.nccgroup.com/2022/09/01/settlers-of-netlink-exploiting-a-limited-uaf-in-nf_tables-cve-2022-32250/)</p> |
25+
| [CVE-2022-29582](https://nvd.nist.gov/vuln/detail/CVE-2022-29582) | A use-after-free vulnerability in fs/io_uring.c due to a race condition in io_uring timeouts | - | <p>> [CVE-2022-29582: An io_uring vulnerability](https://ruia-ruia.github.io/2022/08/05/CVE-2022-29582-io-uring/)</p><p>> [Github: Ruia-ruia/CVE-2022-29582-Exploit](https://github.com/Ruia-ruia/CVE-2022-29582-Exploit)</p> |
26+
| [CVE-2022-27666](https://nvd.nist.gov/vuln/detail/CVE-2022-27666) | A heap buffer overflow vulnerability in IPsec ESP transformation code in net/ipv4/esp4.c and net/ipv6/esp6.c that allows a local attacker with a normal user privilege to overwrite kernel heap objects. | `?` | <p>> [CVE-2022-27666: Exploit esp6 modules in Linux kernel](https://etenal.me/archives/1825)</p><p>> [Github: plummm/CVE-2022-27666](https://github.com/plummm/CVE-2022-27666)</p> |
27+
| [CVE-2022-2602](https://access.redhat.com/security/cve/cve-2022-2602) | A use-after-free vulnerability when an io_uring request is being processed. | | <p>> [DirtyCred Remastered: how to turn an UAF into Privilege Escalation](https://exploiter.dev/blog/2022/CVE-2022-2602.html)</p><p>> [Github: LukeGix/CVE-2022-2602](https://github.com/LukeGix/CVE-2022-2602)</p> |
28+
| [CVE-2022-2588](https://access.redhat.com/security/cve/cve-2022-2588) | A use-after-free vulnerability in route4_change in the net/sched/cls_route.c filter implementation in the Linux kernel. | CAP_NET_ADMIN | <p>> [DirtyCred: Opening Pandora’s Box to Current and Future Container Escapes](https://www.crowdstrike.com/blog/what-is-the-dirtycred-exploit-technique/)</p><p>> [Markakd/CVE-2022-2588](https://github.com/Markakd/CVE-2022-2588)</p> |
2229
| [CVE-2022-25636](https://nvd.nist.gov/vuln/detail/CVE-2022-25636) | An out-of-bounds memory access leads to privilege escalation | CAP_NET_ADMIN | [The Discovery and Exploitation of CVE-2022-25636](https://nickgregory.me/linux/security/2022/03/12/cve-2022-25636/) |
30+
| [CVE-2022-1786](https://nvd.nist.gov/vuln/detail/CVE-2022-1786) | A use-after-free flaw in io_uring subsystem in the way a user sets up a ring with IORING_SETUP_IOPOLL with more than one task completing submissions on this ring. | `?` | [CVE-2022-1786 A Journey To The Dawn](https://blog.kylebot.net/2022/10/16/CVE-2022-1786/) |
31+
| [CVE-2022-1015](https://nvd.nist.gov/vuln/detail/CVE-2022-1015) | A flaw in linux/net/netfilter/nf_tables_api.c of the netfilter subsystem that allows a local user to cause an out-of-bounds write issue | CAP_NET_ADMIN | <p>> [CVE-2022-1015: A validation flaw in Netfilter leading to Local Privilege Escalation](https://ysanatomic.github.io/cve-2022-1015/)</p><p>> [How The Tables Have Turned: An analysis of two new Linux vulnerabilities in nf_tables](https://blog.dbouman.nl/2022/04/02/How-The-Tables-Have-Turned-CVE-2022-1015-1016/)</p> |
32+
| [CVE-2022-0995](https://nvd.nist.gov/vuln/detail/CVE-2022-0995) | An out-of-bounds memory write flaw in watch_queue event notification subsystem that can overwrite parts of the kernel state. | `?` | [Github: Bonfee/CVE-2022-0995](https://github.com/Bonfee/CVE-2022-0995) |
33+
| [CVE-2022-0847](https://nvd.nist.gov/vuln/detail/cve-2022-0847) | A vulnerability which allows overwriting data in arbitrary read-only files and leads to privilege escalation via injecting code into root processes | CAP_DAC_READ_SEARCH | <p>> [The Dirty Pipe Vulnerability](https://dirtypipe.cm4all.com/)</p><p>> [DirtyPipe (CVE-2022-0847) – the new DirtyCoW?](https://jfrog.com/blog/dirtypipe-cve-2022-0847-the-new-dirtycow/)</p><p>> [Github: greenhandatsjtu/CVE-2022-0847-Container-Escape](https://github.com/greenhandatsjtu/CVE-2022-0847-Container-Escape)</p><p>> [Github: Al1ex/CVE-2022-0847](https://github.com/Al1ex/CVE-2022-0847)</p> |
2334
| [CVE-2022-0492](https://nvd.nist.gov/vuln/detail/CVE-2022-0492) | Missing verification allows setting the `release_agent` file for the process without administrative privileges | <p>CAP_SYS_ADMIN</p><p>Disabled AppArmor/SELinux</p><p>Disabled Seccomp</p> | [New Linux Vulnerability CVE-2022-0492 Affecting Cgroups: Can Containers Escape?](https://unit42.paloaltonetworks.com/cve-2022-0492-cgroups/) |
24-
| [CVE-2022-0185](https://access.redhat.com/security/cve/cve-2022-0185) | A heap-based buffer overflow flaw in the legacy_parse_param function in the Filesystem Context functionality of the Linux kernel | <p>CAP_SYS_ADMIN</p><p>or [unshare(CLONE_NEWNS&#124;CLONE_NEWUSER)](https://man7.org/linux/man-pages/man1/unshare.1.html)</p> | <p>> [CVE-2022-0185 - Winning a $31337 Bounty after Pwning Ubuntu and Escaping Google's KCTF Containers](https://www.willsroot.io/2022/01/cve-2022-0185.html)</p><p>> [CVE-2022-0185 in Linux Kernel Can Allow Container Escape in Kubernetes](https://blog.aquasec.com/cve-2022-0185-linux-kernel-container-escape-in-kubernetes)</p><p>> [Demo exploits for CVE-2022-0185](https://github.com/Crusaders-of-Rust/CVE-2022-0185)</p> |
35+
| [CVE-2022-0185](https://access.redhat.com/security/cve/cve-2022-0185) | A heap-based buffer overflow flaw in the legacy_parse_param function in the Filesystem Context functionality of the Linux kernel | <p>CAP_SYS_ADMIN</p><p>or [unshare(CLONE_NEWNS&#124;CLONE_NEWUSER)](https://man7.org/linux/man-pages/man1/unshare.1.html)</p> | <p>> [CVE-2022-0185 - Winning a $31337 Bounty after Pwning Ubuntu and Escaping Google's KCTF Containers](https://www.willsroot.io/2022/01/cve-2022-0185.html)</p><p>> [CVE-2022-0185 in Linux Kernel Can Allow Container Escape in Kubernetes](https://blog.aquasec.com/cve-2022-0185-linux-kernel-container-escape-in-kubernetes)</p><p>> [Github: Crusaders-of-Rust/CVE-2022-0185](https://github.com/Crusaders-of-Rust/CVE-2022-0185)</p> |
2536
| [CVE-2021-22555](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22555) | A heap out-of-bounds write in Linux Netfilter | CAP_NET_ADMIN | [CVE-2021-22555: Turning \x00\x00 into 10000$](https://google.github.io/security-research/pocs/linux/cve-2021-22555/writeup.html) |
2637
| [CVE-2021-31440](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-31440) | The flaw in handling of eBPF programs leads to escalate privileges | CAP_SYS_MODULE | [CVE-2021-31440: AN INCORRECT BOUNDS CALCULATION IN THE LINUX KERNEL EBPF VERIFIER](https://www.zerodayinitiative.com/blog/2021/5/26/cve-2021-31440-an-incorrect-bounds-calculation-in-the-linux-kernel-ebpf-verifier) |
2738
| [CVE-2020-8835](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-8835) | The bpf verifier (kernel/bpf/verifier.c) did not properly restrict the register bounds for 32-bit operations, leading to out-of-bounds reads and writes in kernel memory | CAP_SYS_ADMIN | [CVE-2020-8835: LINUX KERNEL PRIVILEGE ESCALATION VIA IMPROPER EBPF PROGRAM VERIFICATION](https://www.zerodayinitiative.com/blog/2020/4/8/cve-2020-8835-linux-kernel-privilege-escalation-via-improper-ebpf-program-verification) |

Linux/bash-tips.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Bash multiprocessing
44

5-
{% embed url="https://fr1nge.xyz/posts/supercharge-your-bash-scripts-with-multiprocessing/" %}
5+
{% embed url="https://web.archive.org/web/20210625034833/https://fr1nge.xyz/posts/supercharge-your-bash-scripts-with-multiprocessing/" %}
66

77
# Useful commands
88

@@ -186,6 +186,10 @@ $ pv file.txt -L 2 # 2 bytes per second
186186
$ pv file.txt -L -l 2 # 2 lines per second
187187
```
188188

189+
## ssh
190+
191+
{% embed url="https://iximiuz.com/en/posts/ssh-tunnels/" %}
192+
189193
## tar
190194

191195
[tar](https://linux.die.net/man/1/tar) saves many files together into a single tape or disk archive, and can restore individual files from the archive.

SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,6 @@
144144
- [Race Condition](Web%20Application/Race%20Condition/README.md)
145145
- [Server Side Request Forgery](Web%20Application/Server%20Side%20Request%20Forgery/README.md)
146146
- [Post Exploitation](Web%20Application/Server%20Side%20Request%20Forgery/post-exploitation.md)
147+
- [SVG Abuse](Web%20Application/SVG%20Abuse/README.md)
148+
- [Weak Random Generation](Web%20Application/Weak%20Random%20Generation/README.md)
147149
- [Web Cache Poisoning](Web%20Application/Web%20Cache%20Poisoning/README.md)

Web Application/Abusing HTTP hop-by-hop Request Headers/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,4 @@ Remeber that `X-Forwarded-For` header is not the only header for transmitting a
8585

8686
- [Abusing HTTP hop-by-hop request headers](https://nathandavison.com/blog/abusing-http-hop-by-hop-request-headers)
8787
- [Python script to find hop-by-hop header abuse potential against the provided URL](https://gist.github.com/ndavison/298d11b3a77b97c908d63a345d3c624d)
88+
- [Writeup: Worldwide Server-side Cache Poisoning on All Akamai Edge Nodes ($50K+ Bounty Earned)](https://medium.com/@jacopotediosi/worldwide-server-side-cache-poisoning-on-all-akamai-edge-nodes-50k-bounty-earned-f97d80f3922b)

Web Application/Broken Authentication/README.md

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,81 @@ If the operations of adding a new email address or changing an existing one do n
66

77
{% embed url="https://0xn3va.gitbook.io/cheat-sheets/cloud/aws/amazon-cognito" %}
88

9+
# Email confirmation
10+
11+
## Binding an email using a confirmation link
12+
13+
Try to follow a confirmation link for account `A` within the session of account `B` within an email confirmation flow. If an application is vulnerable, it will link the verified email to account `B`. In this case, the attack flow may look like:
14+
15+
1. An attacker links `[email protected]` to their account.
16+
1. An attacker sends a confirmation link to a victim.
17+
1. A victim follows the link from an email while logged into an application.
18+
1. An application links `[email protected]` to a victim.
19+
20+
References:
21+
- [Writeup: Watch out the links : Account takeover!](https://akashhamal0x01.medium.com/watch-out-the-links-account-takeover-32b9315390a7)
22+
23+
## Confirmation of multiple emails
24+
25+
A method for adding new emails can accept several email address in a single request. However, the method can create a one-time token based on only one email, but send an email with a recovery link to all passed emails at once. For instance, if an application is vulnerable to such an attack, on the following request:
26+
27+
```http
28+
PUT /user/profile HTTP/1.1
29+
Host: vulnerable-website.com
30+
Content-Type: application/json
31+
Content-Length: 57
32+
33+
34+
```
35+
36+
an application sends the same confirmation link to two email addresses.
37+
38+
You can also try the following payloads:
39+
40+
```http
41+
42+
43+
44+
45+
46+
47+
...
48+
```
49+
50+
Another similar case is if there is a business logic vulnerability when confirmation link is sent to a wrong email. For example, if an application sends a confirmation link to an already added, main email, instead of an unconfirmed one.
51+
52+
References:
53+
- [Report: Email Confirmation Bypass in myshop.myshopify.com that Leads to Full Privilege Escalation to Any Shop Owner by Taking Advantage of the Shopify SSO](https://hackerone.com/reports/791775)
54+
55+
## Skipping the confirmation process
56+
57+
If an application allows you to create users without an email confirmation process, you can try to abuse that to get a new user with a pre-confirmed email. This is possible at least in the following cases:
58+
59+
- An application allows creation of bot users that have pre-defined confirmed emails.
60+
- SCIM provisioning functions.
61+
- OAuth authentication via a vulnerable service that allows using unconfirmed accounts for authentication.
62+
63+
References:
64+
- [Report: Bypass Email Verification -- Able to Access Internal Gitlab Services that use Login with Gitlab and Perform Check on email domain](https://gitlab.com/gitlab-org/gitlab/-/issues/11643)
65+
66+
## Using unconfirmed emails
67+
68+
If an application allows using unconfirmed emails, try to abuse this behavior in flows where an application or other applications/systems rely on an email address. For example:
69+
70+
- If there are applications/systems that blindly trust the data of a vulnerable application, you can try to abuse this trust. For example, if an application can be used as an OAuth authorization server, try using an account with an unconfirmed email to authenticate to a third-party application using OAuth, you can find more details at [OAuth 2.0 Vulnerabilities: Abusing accounts with unconfirmed email](/Web%20Application/OAuth%202.0%20Vulnerabilities/README.md#abusing-accounts-with-unconfirmed-email).
71+
- Try using unconfirmed emails to preoccupy emails that may be used by other users or used internally by an application. In this case, you can block some application functions for all or specific users.
72+
- If some functions must not be available for users who have not confirmed their email, check that these functions are really not available for them. Additionally, make sure the REST and GraphQL APIs also abide by the same policy.
73+
74+
## Using OTP for email confirmation
75+
76+
{% embed url="https://0xn3va.gitbook.io/cheat-sheets/web-application/broken-authentication#phone-and-otp-authentication" %}
77+
78+
## Weak confirmation token
79+
80+
Confirmation token may be generated using a vulnerable generation algorithm, which may lead to the possibility of predicting the generated values. If you manage to predict tokens you will be able to generate valid confirmation tokens for any emails.
81+
82+
{% embed url="https://0xn3va.gitbook.io/cheat-sheets/web-application/weak-random-generation" %}
83+
984
# Information disclosure
1085

1186
An application can return unknown data in response when performing an operation. These can be requested passwords, generated OTP, cookies with additional privileges, user data, detailed error messages, and etc. Check the response from the server for such data.
@@ -134,10 +209,6 @@ Content-Length: 72
134209

135210
## Password recovery does not end previously created sessions
136211

137-
{% hint style="info" %}
138-
This is the best practice to follow
139-
{% endhint %}
140-
141212
Successful password recovery should end previously created sessions. If this does not happen, an victim will not have mechanisms for managing the security of their account. As a result, an attacker will be able to maintain an active session for an extended period of time.
142213

143214
## Token leakage via Referer header
@@ -153,6 +224,12 @@ References:
153224
- [Report: [Cross Domain Referrer Leakage] Password Reset Token Leaking to Third party Sites.](https://hackerone.com/reports/265740)
154225
- [Report: Referer Referer Header Leakage in language changer may lead to FB token theft](https://hackerone.com/reports/870062)
155226

227+
## Weak recovery token
228+
229+
Recovery token may be generated using a vulnerable generation algorithm, which may lead to the possibility of predicting the generated values. If you manage to predict tokens you will be able to generate valid recovery tokens for any accounts.
230+
231+
{% embed url="https://0xn3va.gitbook.io/cheat-sheets/web-application/weak-random-generation" %}
232+
156233
# Phone and OTP authentication
157234

158235
## OTP resend

Web Application/Command Injection/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ The following `GIT_*` parameters can be used to abuse a git directory:
7070
- [GIT_PROXY_COMMAND](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coregitProxy) is used for overridding `core.gitProxy`
7171
- [GIT_SSH_COMMAND](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresshCommand) is used for overridding `core.sshCommand`
7272
- [GIT_EXTERNAL_DIFF](https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffexternal) is used for overridding `diff.external`
73+
- [GIT_CONFIG*](https://git-scm.com/docs/git-config#Documentation/git-config.txt-GITCONFIGCOUNT). Modern versions of Git support setting any config value via `GIT_CONFIG*` environment variables
7374

74-
{% embed url="https://0xn3va.gitbook.io/cheat-sheets/web-application/command-injection/parameters-injection@abusing-a-git-directory" %}
75+
{% embed url="https://0xn3va.gitbook.io/cheat-sheets/web-application/command-injection/parameters-injection#abusing-a-git-directory" %}
7576

7677
## LD_PRELOAD
7778

@@ -344,6 +345,15 @@ Open3.capture2e("os command here")
344345
Open3.pipeline("os command here")
345346
```
346347
348+
# Linux files
349+
350+
## /etc/environment
351+
352+
[/etc/environment](https://man7.org/linux/man-pages/man7/environ.7.html) contains environment variables specifying the basic environment variables for new shells. However, it can be used by other programs. Every executed job in the Linux task scheduler (cron) imports this file, and if there is a job that is executed by a user (e.g. root), you can abuse `/etc/environment` to execute arbitrary code on behalf of that user. For example, you can use [LD_PRELOAD](#ld_preload) to gain code execution.
353+
354+
References:
355+
- [FabricScape: Escaping Service Fabric and Taking Over the Cluster](https://unit42.paloaltonetworks.com/fabricscape-cve-2022-30137/)
356+
347357
# Tips
348358
349359
## Brace expansion

0 commit comments

Comments
 (0)