Skip to content

Commit

Permalink
fix harnesses
Browse files Browse the repository at this point in the history
  • Loading branch information
xansec authored and ForAllSecure Mayhem Bot committed Jan 24, 2025
1 parent 582ff2c commit d0c54c9
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
!/debian
!/scripts
!/reg-tests
!/mayhem
# Reject some generic files
*.o
*.a
Expand Down
12 changes: 12 additions & 0 deletions mayhem/Dockerfile.haproxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu AS builder

RUN apt update -y && DEBIAN_FRONTEND=noninteractive apt install -y gcc make
RUN mkdir /work
COPY . /work
WORKDIR /work
RUN make TARGET=linux-glibc

FROM ubuntu
COPY --from=builder /work/haproxy /
COPY --from=builder /work/mayhem/haproxy.cfg /
RUN mkdir -p /var/lib/haproxy
3 changes: 3 additions & 0 deletions mayhem/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ sed 's/int main(int argc/int main2(int argc/g' -i ./src/haproxy.c
sed 's/dladdr(main,/dladdr(main2,/g' -i ./src/tools.c
sed 's/(void*)main/(void*)main2/g' -i ./src/tools.c

# make read_cfg visible
sed 's/static int read_cfg/int read_cfg/' -i ./src/haproxy.c


SETTINGS="-Iinclude -g -DUSE_POLL -DUSE_TPROXY -DCONFIG_HAPROXY_VERSION=\"\" -DCONFIG_HAPROXY_DATE=\"\""

Expand Down
2 changes: 1 addition & 1 deletion mayhem/fuzz_cfg_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
fclose(fp);

// Fuzz the cfg parser
readcfgfile(filename);
read_cfg(filename);

unlink(filename);

Expand Down
3 changes: 2 additions & 1 deletion mayhem/fuzz_cfg_parser.mayhemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
project: PROJECT
image: ghcr.io/mayhemheroes/haproxy:latest
project: haproxy
target: fuzz_cfg_parser
cmds:
- cmd: /out/fuzz_cfg_parser
5 changes: 5 additions & 0 deletions mayhem/fuzz_hpack_decode.mayhemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image: ghcr.io/mayhemheroes/haproxy:latest
project: haproxy
target: fuzz_hpack_decode
cmds:
- cmd: /out/fuzz_hpack_decode
14 changes: 14 additions & 0 deletions mayhem/haproxy.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
global
chroot /var/lib/haproxy
stats timeout 30s
user root
group root

defaults
timeout connect 5000
timeout client 50000
timeout server 50000

frontend http_front
bind *:8080
mode http
21 changes: 21 additions & 0 deletions mayhem/haproxy.mayhemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
image: ghcr.io/mayhemheroes/haproxy-bin:latest
duration: 600
project: haproxy
target: haproxy
advanced_triage: true
tasks:
- name: exploitability_factors
- name: behavior_testing
- name: coverage_analysis
cmds:
- cmd: /haproxy -f /haproxy.cfg
network:
url: 'tcp://localhost:8080'
timeout: 2
client: false






0 comments on commit d0c54c9

Please sign in to comment.