Skip to content

Commit af50148

Browse files
committed
init
0 parents  commit af50148

11 files changed

+5866
-0
lines changed

.config

+4,032
Large diffs are not rendered by default.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
expl.bin
2+
tags

Dockerfile

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM ubuntu:20.04
2+
LABEL org.opencontainers.image.authors="[email protected]"
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV TERM="xterm"
6+
ENV FORCE_UNSAFE_CONFIGURE=1
7+
8+
9+
RUN apt-get update && \
10+
apt-get -y install neovim make cmake build-essential git wget cpio python3 unzip file rsync bc libncurses-dev python-is-python3
11+
12+
COPY .config /in/.config
13+
COPY Makefile.patch /in/Makefile.patch
14+
15+
# Install buildroot
16+
WORKDIR /build
17+
RUN git clone git://git.buildroot.net/buildroot && \
18+
cd buildroot && \
19+
git checkout 2018.08.x && \
20+
cp /in/.config .config && \
21+
make toolchain
22+
23+
ENV PATH=$PATH:/build/buildroot/output/host/usr/bin
24+
25+
COPY make.sh /in/make.sh
26+
# Fetch Caraboot-ipq
27+
WORKDIR /build
28+
RUN git clone https://github.com/8devices/Caraboot-ipq.git && \
29+
cd Caraboot-ipq && \
30+
git checkout 8dev/jalapeno && \
31+
cp /in/make.sh make.sh && \
32+
chmod +x make.sh && \
33+
patch -p1 < /in/Makefile.patch
34+
35+
WORKDIR /build/Caraboot-ipq
36+
37+
# Entrypoint
38+
CMD ["/bin/bash"]
39+

Makefile.patch

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
2+
index baaa2fbe4d..1b1ac155ad 100644
3+
--- a/examples/standalone/Makefile
4+
+++ b/examples/standalone/Makefile
5+
@@ -63,7 +63,9 @@ LIBCOBJS = stubs.o
6+
LIBOBJS = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
7+
8+
SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
9+
-OBJS := $(addprefix $(obj),$(COBJS))
10+
+
11+
+CACHE_OBJS := /build/Caraboot-ipq/arch/arm/cpu/armv7/cache_v7.o
12+
+OBJS := $(addprefix $(obj),$(COBJS)) $(CACHE_OBJS)
13+
ELF := $(addprefix $(obj),$(ELF))
14+
BIN := $(addprefix $(obj),$(BIN))
15+
SREC := $(addprefix $(obj),$(SREC))
16+
@@ -97,7 +99,7 @@ $(LIB): $(obj).depend $(LIBOBJS)
17+
$(ELF):
18+
$(obj)%: $(obj)%.o $(LIB)
19+
$(LD) $(LDFLAGS) -g -Ttext $(CONFIG_STANDALONE_LOAD_ADDR) \
20+
- -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
21+
+ -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) $(CACHE_OBJS) \
22+
-L$(gcclibdir) -lgcc
23+
24+
$(SREC):

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# QSEE Exploit PoC
2+
3+
## Overview
4+
5+
This repository contains a Proof of Concept (PoC) that demonstrates an exploit of the Qualcomm Secure Execution Environment (QSEE) in ARM TrustZone. The exploit allows for arbitrary code execution with TrustZone privileges on supported devices. The PoC was developed on a LinkSys AC2200 router. However the general idea of this exploit seems to be working on any Qualcomm IPQ40XX chipsets.
6+
7+
**Disclaimer**: This research is based on public knowledge and is implemented for educational purposes to understand QSEE/TrustZone vulnerabilities. The original research was conducted by [raelize](https://raelize.com/blog/qualcomm-ipq40xx-an-unexpected-cup-of-tee/), which I highly recommend checking out.
8+
9+
## Features
10+
11+
- Exploitation of QSEE vulnerabilities
12+
- Demonstration of arbitrary code execution from TrustZone
13+
- SVC (Supervisor Call) enumeration
14+
- Visualization of secure memory ranges
15+
16+
## Prerequisites
17+
18+
- Docker
19+
20+
## Building the Exploit
21+
22+
The exploit code is located in `hello-world.c` and is compiled as a standalone executable using the [Caraboot](https://github.com/8devices/Caraboot-ipq) stack.
23+
The exploit should be compilable with any other stack that allows building an ARMv7 32-bit little-endian standalone applications and links against U-Boot.
24+
25+
```sh
26+
docker build -t ipq40xx_expl . -f Dockerfile
27+
./run.sh
28+
```
29+
30+
_Note_: The `./run.sh` mounts the host directory `/srv/tftp/` to `/out` inside the container. If you do not have that directory modify the script, because that host location is used to store the compiled exploit.
31+
32+
## Showcase
33+
34+
- SVC enum:
35+
36+
![svc_enum](./imgs/strat0.png)
37+
38+
- Secure ranges visualization:
39+
40+
![srange_vis](./imgs/strat1.png)
41+
42+
- Code execution PoC:
43+
44+
![code_exec](./imgs/strat2.png)
45+
46+
## Disclaimer
47+
48+
This project is for educational and research purposes only. The authors are not responsible for any misuse or damage caused by this software. Always obtain proper authorization before testing on any systems you do not own or have explicit permission to test.

0 commit comments

Comments
 (0)