Skip to content

Commit bc9ef1b

Browse files
authored
Merge branch 'google:master' into CVE-2023-5717_mitigation
2 parents 616106b + aab489f commit bc9ef1b

File tree

242 files changed

+34343
-38
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+34343
-38
lines changed

.github/workflows/kernelctf-submission-verification.yaml

+71-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,34 @@ on:
33
pull_request_target:
44
types: [opened, synchronize, reopened, labeled]
55
paths: [pocs/linux/kernelctf/**]
6+
workflow_call:
7+
inputs:
8+
prNumber:
9+
description: 'PR number'
10+
type: number
11+
shaHash:
12+
description: 'SHA hash'
13+
type: string
14+
skipRepro:
15+
description: 'Skip reproduction'
16+
type: boolean
17+
required: false
18+
default: false
619
workflow_dispatch:
720
inputs:
821
prNumber:
922
description: 'PR number'
1023
type: number
1124
shaHash:
1225
description: 'SHA hash'
26+
skipRepro:
27+
description: 'Skip reproduction'
28+
type: boolean
29+
required: false
30+
default: false
1331
permissions: {}
1432
env:
15-
PR_REF: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.shaHash || format('refs/pull/{0}/merge', github.event.inputs.prNumber)) || github.event.pull_request.head.sha }}
33+
PR_REF: ${{ contains(github.event_name, 'workflow_') && (inputs.shaHash || format('refs/pull/{0}/merge', inputs.prNumber)) || github.event.pull_request.head.sha }}
1634
jobs:
1735
structure_check:
1836
# if labeling triggered the job then only run in case of the "recheck" label
@@ -84,15 +102,15 @@ jobs:
84102
if: success()
85103
uses: actions/upload-artifact@v4
86104
with:
87-
name: exploit_${{ env.RELEASE_ID }}
105+
name: ${{ needs.structure_check.outputs.artifact_backup_dir }}_exploit_${{ env.RELEASE_ID }}
88106
path: ${{ env.EXPLOIT_DIR }}/exploit
89107
if-no-files-found: error
90108

91109
- name: Upload exploit (original, build failed)
92110
if: failure() && steps.build_exploit.outcome == 'failure'
93111
uses: actions/upload-artifact@v4
94112
with:
95-
name: exploit_${{ env.RELEASE_ID }}
113+
name: ${{ needs.structure_check.outputs.artifact_backup_dir }}_exploit_${{ env.RELEASE_ID }}
96114
path: ./exploit
97115
if-no-files-found: error
98116

@@ -104,16 +122,60 @@ jobs:
104122
if: failure() && steps.build_exploit.outcome == 'failure'
105123
run: printf '❌ The exploit compilation failed.\n\nPlease fix it.\n\nYou can see the build logs by clicking on `...` here and then on "View job logs". Or by selecting `exploit_build (${{ env.RELEASE_ID }})` under Jobs in the left menubar.\n' >> $GITHUB_STEP_SUMMARY
106124

125+
exploit_build_debug:
126+
runs-on: ubuntu-latest
127+
needs: structure_check
128+
permissions: {}
129+
strategy:
130+
matrix:
131+
target: ${{ fromJSON(needs.structure_check.outputs.targets) }}
132+
fail-fast: false # do not cancel other targets
133+
env:
134+
RELEASE_ID: ${{ matrix.target }}
135+
EXPLOIT_DIR: pr/pocs/linux/kernelctf/${{ needs.structure_check.outputs.submission_dir }}/exploit/${{ matrix.target }}
136+
steps:
137+
- name: Checkout PR content
138+
uses: actions/checkout@v4
139+
with:
140+
path: pr
141+
ref: ${{ env.PR_REF }}
142+
fetch-depth: 0
143+
144+
- name: Convert exploit to debug build
145+
working-directory: ${{ env.EXPLOIT_DIR }}
146+
run: |
147+
sed -i '/gcc -g/!s/gcc/gcc -g/g' Makefile
148+
sed -i '/configure --enable-debug/!s/configure/configure --enable-debug/g' Makefile
149+
sed -i 's/-o exploit /-o exploit_debug /g' Makefile
150+
sed -i 's/ -s\b//g' Makefile
151+
sed -i 's/exploit:/exploit_debug:/g' Makefile
152+
153+
- name: Build exploit
154+
working-directory: ${{ env.EXPLOIT_DIR }}
155+
run: |
156+
if make -n prerequisites; then
157+
make prerequisites
158+
fi
159+
make exploit_debug
160+
file exploit_debug | grep debug_info
161+
162+
- name: Upload debug build
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: ${{ needs.structure_check.outputs.artifact_backup_dir }}_exploit_debug_${{ env.RELEASE_ID }}
166+
path: ${{ env.EXPLOIT_DIR }}/exploit_debug
167+
if-no-files-found: error
168+
107169
exploit_repro:
108-
runs-on: ubuntu-22.04-4core
170+
runs-on: ubuntu-latest
109171
timeout-minutes: 300
110172
permissions: {}
111173
needs: [structure_check, exploit_build]
112174
strategy:
113175
matrix:
114176
target: ${{ fromJSON(needs.structure_check.outputs.targets) }}
115177
fail-fast: false
116-
if: always() && needs.structure_check.result == 'success'
178+
if: always() && needs.structure_check.result == 'success' && !inputs.skipRepro
117179
env:
118180
RELEASE_ID: ${{ matrix.target }}
119181
SUBMISSION_DIR: ${{ needs.structure_check.outputs.submission_dir }}
@@ -210,7 +272,7 @@ jobs:
210272
- name: Upload repro QEMU logs as an artifact
211273
uses: actions/upload-artifact@v4
212274
with:
213-
name: repro_logs_${{ env.RELEASE_ID }}
275+
name: ${{ needs.structure_check.outputs.artifact_backup_dir }}_repro_logs_${{ env.RELEASE_ID }}
214276
path: ./kernelctf/repro/repro_log_*.txt
215277

216278
- name: Reproduction // Summary
@@ -223,13 +285,13 @@ jobs:
223285
- name: Upload repro summary as an artifact
224286
uses: actions/upload-artifact@v4
225287
with:
226-
name: repro_summary_${{ env.RELEASE_ID }}
288+
name: ${{ needs.structure_check.outputs.artifact_backup_dir }}_repro_summary_${{ env.RELEASE_ID }}
227289
path: ./kernelctf/repro/repro_summary.md
228290

229291
backup_artifacts:
230292
runs-on: ubuntu-latest
231-
needs: [structure_check, exploit_build, exploit_repro]
232-
if: always() && needs.structure_check.result == 'success'
293+
needs: [structure_check, exploit_build, exploit_build_debug, exploit_repro]
294+
if: always() && needs.structure_check.result == 'success' && github.event_name != 'workflow_call'
233295
steps:
234296
- name: Download artifacts
235297
uses: actions/download-artifact@v4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: kernelCTF verify all PRs again
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
prs:
6+
description: 'PRs to verify'
7+
type: string
8+
required: true
9+
skipRepro:
10+
description: 'Skip reproduction'
11+
type: boolean
12+
required: false
13+
default: false
14+
permissions: {}
15+
jobs:
16+
verify:
17+
strategy:
18+
matrix:
19+
pr: ${{ fromJSON(format('[{0}]', inputs.prs)) }}
20+
fail-fast: false # do not cancel test of other targets
21+
uses: ./.github/workflows/kernelctf-submission-verification.yaml
22+
secrets: inherit
23+
with:
24+
prNumber: ${{ matrix.pr }}
25+
skipRepro: ${{ inputs.skipRepro }}
26+
27+
backup_artifacts:
28+
runs-on: ubuntu-latest
29+
needs: [verify]
30+
if: always()
31+
steps:
32+
- name: Download artifacts
33+
uses: actions/download-artifact@v4
34+
with:
35+
path: ./artifacts
36+
37+
- name: Authenticate to Google Cloud
38+
uses: google-github-actions/auth@v2
39+
with:
40+
credentials_json: '${{secrets.KERNELCTF_GCS_SA_KEY}}'
41+
42+
- name: Upload artifacts to GCS
43+
uses: 'google-github-actions/upload-cloud-storage@v2'
44+
with:
45+
path: ./artifacts
46+
destination: kernelctf-build/artifacts/verify_all_${{ github.run_id }}_pr${{ join(fromJSON(format('[{0}]', inputs.prs)), '_') }}
47+
parent: false
48+
predefinedAcl: publicRead
49+
process_gcloudignore: false # removes warnings that .gcloudignore file does not exist

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "pocs/cpus/entrysign/zentool/CPUMicrocodes"]
2+
path = pocs/cpus/entrysign/zentool/data/CPUMicrocodes
3+
url = https://github.com/platomav/CPUMicrocodes

README.md

-22
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,6 @@ advisories, which can be browsed in the [Security
2020
Advisories](https://github.com/google/security-research/security/advisories?state=published)
2121
page.
2222

23-
## Proof of Concepts
24-
25-
Accompanying proof-of-concept code will be used to demonstrate the
26-
security vulnerabilities.
27-
28-
| Year | Title | Advisories | Links |
29-
| ---- | ----- | ---------- | ----- |
30-
| 2023 | Oracle VM VirtualBox 7.0.10 r158379 Escape | [CVE-2023-22098](https://github.com/google/security-research/security/advisories/GHSA-q7p4-pxjx-6h42) | [PoC](pocs/oracle/virtualbox/cve-2023-22098)
31-
| 2023 | Linux: eBPF Path Pruning gone wrong | [CVE-2023-2163](https://github.com/google/security-research/security/advisories/GHSA-j87x-j6mh-mv8v) | [PoC](pocs/linux/cve-2023-2163)
32-
| 2023 | XGETBV is non-deterministic on Intel CPUs | | [PoC](pocs/cpus/xgetbv)
33-
| 2023 | XSAVES Instruction May Fail to Save XMM Registers | | [PoC](pocs/cpus/errata/amd/1386)
34-
| 2022 | RET2ASLR - Leaking ASLR from return instructions | | [PoC](pocs/cpus/ret2aslr/src)
35-
| 2022 | Unexpected Speculation Control of RETs | | [PoC](pocs/cpus/top-of-stack)
36-
| 2022 | Bleve Library: Traversal Vulnerabilities in Create / Delete IndexHandler | [GHSA-gc7p-j7x8-h873](https://github.com/google/security-research/security/advisories/GHSA-gc7p-j7x8-h873) | [PoC](pocs/bleve)
37-
| 2022 | Microsoft: CBC Padding Oracle in Azure Blob Storage Encryption Library | [CVE-2022-30187](https://github.com/google/security-research/security/advisories/GHSA-6m8q-r22q-vfxh) | [PoC](pocs/azure/oracle/net/keymaterial/azure)
38-
| 2022 | Apple: Heap-based Buffer Overflow in libresolv | [GHSA-6cjw-q72j-mh57](https://github.com/google/security-research/security/advisories/GHSA-6cjw-q72j-mh57) | [PoC](pocs/apple/libresolv)
39-
| 2022 | Apache: Code execution in log4j2 | [CVE-2021-45046](https://github.com/google/security-research/security/advisories/GHSA-ggmf-hg75-88gg) | [PoC](pocs/log4j)
40-
| 2021 | Surface Pro 3: BIOS False Health Attestation (TPM Carte Blanche) | [CVE-2021-42299](https://github.com/google/security-research/security/advisories/GHSA-c4qg-jj77-rcc3) | [Write-up](https://google.github.io/security-research/pocs/bios/tpm-carte-blanche/writeup.html), [PoC](pocs/bios/tpm-carte-blanche)
41-
| 2021 | CVE-2021-22555: Turning \x00\x00 into 10000$ | [CVE-2021-22555](https://github.com/google/security-research/security/advisories/GHSA-xxx5-8mvq-3528) | [Write-up](https://google.github.io/security-research/pocs/linux/cve-2021-22555/writeup.html), [PoC](pocs/linux/cve-2021-22555)
42-
| 2021 | Linux: KVM VM_IO\|VM_PFNMAP vma mishandling | [CVE-2021-22543](https://github.com/google/security-research/security/advisories/GHSA-7wq5-phmq-m584) | [PoC](pocs/linux/kvm_vma)
43-
| 2021 | BleedingTooth: Linux Bluetooth Zero-Click Remote Code Execution | [CVE-2020-24490](https://github.com/google/security-research/security/advisories/GHSA-ccx2-w2r4-x649), [CVE-2020-12351](https://github.com/google/security-research/security/advisories/GHSA-h637-c88j-47wq), [CVE-2020-12352](https://github.com/google/security-research/security/advisories/GHSA-7mh3-gq28-gfrq) | [Write-up](https://google.github.io/security-research/pocs/linux/bleedingtooth/writeup.html), [PoC](pocs/linux/bleedingtooth)
44-
4523
# License & Patents
4624

4725
The advisories and patches posted here are free and open source.

kernelctf/server/qemu.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ HARDENING=""
1414
if [[ "$RELEASE" == "mitigation-"* ]]; then
1515
HARDENING="sysctl.kernel.dmesg_restrict=1 sysctl.kernel.kptr_restrict=2 sysctl.kernel.unprivileged_bpf_disabled=2 sysctl.net.core.bpf_jit_harden=1 sysctl.kernel.yama.ptrace_scope=1 slab_virtual=1 slab_virtual_guards=1";
1616
elif [[ $(date +%Y-%m-%d) > "2025-02-28" ]]; then
17-
HARDENING="net.core.bpf_jit_harden=2"
17+
HARDENING="sysctl.net.core.bpf_jit_harden=2"
1818
fi
1919

2020
IO_URING="sysctl.kernel.io_uring_disabled=2"

kernelctf/server/releases.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
lts-6.6.80:
2+
release-date: 2025-03-07T12:00:00Z
3+
cos-105-17412.535.61:
4+
release-date: 2025-03-07T12:00:00Z
5+
cos-109-17800.436.42:
6+
release-date: 2025-03-07T12:00:00Z
7+
18
lts-6.6.77:
29
release-date: 2025-02-21T12:00:00Z
310
cos-105-17412.535.55:

kernelctf/server/server.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def main():
149149
print()
150150

151151
# long random generated secret, not bruteforcable
152-
root = hashlib.sha1(action.encode('utf-8')).hexdigest() == server_secrets.root_mode_hash
152+
root = '--root' in sys.argv or hashlib.sha1(action.encode('utf-8')).hexdigest() == server_secrets.root_mode_hash
153153

154154
if action == 'back':
155155
break
@@ -182,8 +182,24 @@ def main():
182182

183183
flagPrefix = 'invalid:'
184184
if release['status'] == 'future':
185-
flagPrefix = 'future:'
186-
if not are_you_sure('[!] Warning: this target is not released yet and not eligible! Use only for pre-testing.'):
185+
print('[!] Warning: this target is not released yet and not eligible! Use only for pre-testing.')
186+
answer = input('Do you want to run anyway (y/n) or wait until the slot opening (w) ')
187+
if answer == 'y':
188+
flagPrefix = 'future:'
189+
elif answer == 'w':
190+
prev_notification = 0
191+
while True:
192+
time_left = int((release['release-date'] - datetime.now(timezone.utc)).total_seconds())
193+
if time_left <= 0:
194+
flagPrefix = ''
195+
break
196+
197+
if prev_notification != time_left:
198+
print(f'Only {time_left} seconds left...')
199+
prev_notification = time_left
200+
201+
time.sleep(0.05) # check 20 times per second, start as soon as possible
202+
else:
187203
continue
188204
elif release['status'] == 'deprecated' and "io_uring" in capabilities and now >= datetime(2025, 1, 23, 12, 00, 00, tzinfo=timezone.utc):
189205
# you can target deprecated releases during the io_uring promotion

kernelctf/server/service.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
echo running!
33

44
cd /home/poprdi
5-
socat ssl-l:1337,reuseaddr,fork,cert=server_cert_and_key.pem,verify=0,openssl-min-proto-version=tls1.3 exec:"nsjail/nsjail --chroot / --user 99999 --group 99999 --disable_clone_newnet --rlimit_cpu 1800 -T /tmp/ -- /usr/bin/timeout 1800 /home/poprdi/server.py"
5+
socat -dd ssl-l:1337,reuseaddr,fork,cert=server_cert_and_key.pem,verify=0,openssl-min-proto-version=tls1.3 exec:"nsjail/nsjail --chroot / --user 99999 --group 99999 --disable_clone_newnet --disable_rlimits -T /tmp/ -- /usr/bin/timeout 1800 /home/poprdi/server.py"
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.sw?
2+
*.o
3+
data/*.bin.txt
4+
data/updates
5+
/*.bin
6+
mcas
7+
mcop
8+
zentool
9+
opcodes
10+
mtalk
11+
NOTES
12+
*_fields.h
13+
*.tar.gz
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
+ data/*.json
2+
+ data/*.bin
3+
- *.bin
4+
- *.o
5+
- *.a
6+
- .*.sw?
7+
- *.json
8+
- .git
9+
- .sw?
10+
- autoexec.sh
11+
- opcodes
12+
- mcas
13+
- mcop
14+
- zentool
15+
- mtalk
16+
- *.tar.gz

0 commit comments

Comments
 (0)