riscure / optee_fuzzer Goto Github PK
View Code? Open in Web Editor NEWThis repository contains the code for a fuzzing prototype for the OP-TEE system call interface using AFL.
License: GNU General Public License v3.0
This repository contains the code for a fuzzing prototype for the OP-TEE system call interface using AFL.
License: GNU General Public License v3.0
In optee_os.diff around line 420:
+#include "../../../afl-tee/shared/info.c"
+#include "../../../afl-tee/shared/validate.c"
+
+#include "../../../afl-tee/shared/include/afl-tee-trace.h"
However this repo DOES NOT contain afl-tee
.
Besides, build.diff generates build/Makefile like this:
##########
# AFL-TEE
##########
.PHONY: afl
afl:
cd ../afl && AFL_NO_X86=1 CC=$(AARCH64_CROSS_COMPILE)gcc make clean all
.PHONY: afl-tee
afl-tee:
cd ../afl-tee && CC=$(AARCH64_CROSS_COMPILE)gcc make CROSS_COMPILE_S_USER=$(CROSS_COMPILE_S_USER) \
CROSS_COMPILE_NS_USER=$(CROSS_COMPILE_NS_USER) \
TEEC_EXPORT=$(OPTEE_CLIENT_EXPORT) \
TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR)
Where are these two directories: afl
and afl-tee
? This really confused me a lot.
I have modified the wrong patches, but still stuck at this problem.
Question: How to get seeds as fuzzer input
AFL_POST_LIBRARY=/path/to/fuzzer/afl_validate.so afl-fuzz -i /path/to/fuzzer/seeds -t 300+ -o /tmp/state -M $1 -- /path/to/fuzzer/tee_invoke_svc
Prerequisite:
system calls as data
.but we how to get the system calls data
as fuzzer seed?
I think the struct CTX
in afl-tee/shared/include/afl-tee.h
maybe important.
typedef struct {
uint8_t nr;
uint8_t __pad[3]; // It seems it's cheaper to have aligned accesses with 3 pad bytes than unaligned mem
uint32_t arg_type; /* arg_type[TEE_SVC_MAX_ARGS]; */
SYSCALL_ARG args[]; /* args[TEE_SVC_MAX_ARGS]; */
} SYSCALL_INVOKE __attribute__ (( aligned(8) ));
typedef struct {
const void* const buf;
const size_t buf_len;
const SYSCALL_INVOKE* const cmd_first;
const SYSCALL_INVOKE* cmd_current;
const void* const data;
const size_t data_len;
char** p_error;
} CTX;
Hi there,
I'm wondering how you handle with complicated structures which are used by syscalls……
For example, when fuzzing the function "cipher_update", the first parameter is "cryp_handle", which should be a meaningful pointer that points to a real complex structure, and this structure contains even more pointers and sub-structures. Simply doing bitflip of the function calls seems not feasible. How did you solve this problem?
So grateful if you could help me with it :)
$ git apply optee_fuzzer/patches/optee-3.3/build.diff
optee_fuzzer/patches/optee-3.3/build.diff:37: trailing whitespace.
echo "slink /lib/libsqlfs.so libsqlfs.so.1 755 0 0" >> $(fl); \
error: corrupt patch at line 124
why this problem occured and how can I solve it,please?
How do they apply the patches to the OP-TEE build system, client library and OS?
what is there to do?
Hello, I have read part of your code and watched your video, and learned a lot. Thank you very much.
I have a question that I don't know how you get coverage, I can see that you are handling bitmaps in TA, but I'm not sure if you have instrumentation or anything like that.
The code looks a little difficult. If possible, could you please help me solve it
Looking forward to your reply
we konw before use afl-fuzz
, we need to insert code by afl-gcc
;
However, in this response ,wo dont use afl-gcc
;
So, we have to call __afl_log
by optee fuzzer ;
I dont find any code,that use __afl_log
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.