Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2023-0179 PoC — Linux kernel 输入验证错误漏洞

Source
Associated Vulnerability
Title:Linux kernel 输入验证错误漏洞 (CVE-2023-0179)
Description:Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel存在安全漏洞。攻击者利用该漏洞通过执行任意代码将本地权限提升到root权限。
Readme
# Needle (CVE-2023-0179) exploit

This repository contains the exploit for my recently discovered vulnerability in the nftables subsystem that was assigned CVE-2023-0179, affecting all Linux versions from 5.5 to 6.2-rc3, although the exploit was tested on 6.1.6.

The vulnerability details and writeup can be found on [oss-security](https://www.openwall.com/lists/oss-security/2023/01/13/2)

## Building instructions
Just invoke the `make needle` command to generate the corresponding executable.

`libmnl` and `libnftnl` are required for the build to succeed:
```bash
sudo apt-get install libmnl-dev libnftnl-dev
```

## Infoleak

The exploit will enter an unprivileged user and network namespace and add an `nft_payload` expression via the `rule_add_payload` function which, when evaluated, will trigger the stack buffer overflow and overwrite the registers.

The content is then retrieved with the following nft command:

`nft list map netdev mytable myset12`

The output will leak several shuffled addresses relative to kernel data structures, among which we find a kernel instruction address and the regs pointer.

## LPE

The exploit creates a new user account `needle:needle` with UID 0 by abusing the `modprobe_path` variable.

Enjoy root privileges.

## Demo

[![asciicast](https://asciinema.org/a/mVTu420tWy8ocdFY70sWD9VLO.svg)](https://asciinema.org/a/mVTu420tWy8ocdFY70sWD9VLO)

## Credits
- David Bouman's `libnftnl` [implementation](https://github.com/pqlx/CVE-2022-1015) and detailed [blog post](https://blog.dbouman.nl/2022/04/02/How-The-Tables-Have-Turned-CVE-2022-1015-1016/)
File Snapshot

[4.0K] /data/pocs/611a8649cd96dfedaa74aacc452dec5887abf461 ├── [134K] config ├── [ 13K] exploit.c ├── [1.4K] exploit.h ├── [ 12K] helpers.c ├── [3.0K] helpers.h ├── [1.0K] LICENSE ├── [ 247] Makefile ├── [4.6K] needle.c ├── [1.6K] README.md ├── [1.1K] run.sh └── [ 430] setup.sh 0 directories, 11 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.