Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nasm_cve-2018-16517 #11

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data_augmentation/methods/ConcFuzz/crash_tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ lua_cve-2019-6706: asan;0;lapi.c:1294
libjpeg_cve-2018-19664: asan;0;oracle_source/wrbmp.c:145
libjpeg_cve-2017-15232: asan;0;oracle_source/jquant1.c:536
libxml2_cve-2017-5969: asan;0;oracle_source/valid.c:1181
nasm_cve-2018-16517: asan;2;oracle_source/asm/nasm.c:1484
readelf_cve-2019-9077: asan;0;binutils/readelf.c:16204
mruby_hackerone-reports-185041: asan;4;error.c:290
17 changes: 17 additions & 0 deletions targets/nasm_cve-2018-16517/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CVE-2018-16517
## reference
https://packetstormsecurity.com/files/152566/Netwide-Assembler-NASM-2.14rc15-Null-Pointer-Dereference.html
## description

Even though there is no label for equ command, nasm run as if the label exists while the label pointer is NULL and occurs Null Pointer Dereference.

## patch
https://github.com/netwide-assembler/nasm/commit/e996d28c70d45008085322b442b44a9224308548

## fixed files

https://github.com/netwide-assembler/nasm/commit/e996d28c70d45008085322b442b44a9224308548#diff-53dd0f5a0dbace1711e5109a395f58c53a6ba9fc6952c74a2420e9d7d027bb04

## Source of PoC

https://packetstormsecurity.com/files/152566/Netwide-Assembler-NASM-2.14rc15-Null-Pointer-Dereference.html
23 changes: 23 additions & 0 deletions targets/nasm_cve-2018-16517/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

cd $TARGET_ROOT

. ${TARGET_ROOT}/config.sh

git clone --branch nasm-2.14rc15 --depth 1 https://github.com/netwide-assembler/nasm.git $1
cd ${TARGET_ROOT}/$1
sh autogen.sh

TARGET_DEF_CFLAGS="${TARGET_DEF_CFLAGS-} "
TARGET_DEF_CXXFLAGS="${TARGET_DEF_CXXFLAGS-} "
ARGS=""
for var in "${!TARGET_DEF_@}"; do
ARGS="${ARGS} ${var#TARGET_DEF_}=\"$(echo ${!var})\""
done

eval ./configure 'CFLAGS="-static -static-libasan"'

eval make ${ARGS} -j$(nproc) nasm

#set +e
#./nasm -f elf ../poc
6 changes: 6 additions & 0 deletions targets/nasm_cve-2018-16517/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the shebang must be on the first line. The output from shellcheck:

targets/nasm_cve-2018-16517/config.sh:2:1: error: The shebang must be on the first line. Delete blanks and move comments. [SC1128]

#!/bin/bash
set -eux

export RELPATH=nasm
export ARGS="-f elf @@"
4 changes: 4 additions & 0 deletions targets/nasm_cve-2018-16517/preinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

apt-get update
apt-get install -y --no-install-recommends build-essential autoconf
7 changes: 7 additions & 0 deletions targets/nasm_cve-2018-16517/root_causes/locations
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
asm/nasm.c:1477
asm/nasm.c:1478
asm/nasm.c:1479
asm/nasm.c:1480
asm/nasm.c:1481
asm/nasm.c:1482
asm/nasm.c:1483
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asm/ must be removed because Aurora shows only basename-ed name. nasm.c is enough.

Empty file.
1 change: 1 addition & 0 deletions targets/nasm_cve-2018-16517/seeds/default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
equ push rax