[TOC]
Hodor for node.js
optional arguments:
-h, --help show this help message and exit
-f FILETYPE, --fileType FILETYPE
file type, including file or package
-p PATH, --path PATH file path
-i INIT, --init-name INIT
init file name
python3 hodor.py -f package -p {Application packages} -i {init}
download node source code git clone https://github.com/nodejs/node.git
- download musl gcc
curl -LO https://musl.cc/x86_64-linux-musl-native.tgz
- extract musl gcc
tar zxvf x86_64-linux-musl-native.tgz
- link musl gcc's
libc.so
to system pathsudo ln -s $YOUR_PATH/x86_64-linux-musl-native/lib/libc.so /lib/ld-musl-x86_64.so.1
download libseccomp source code https://github.com/seccomp/libseccomp.git
- put seccomp.h and seccomp-syscalls.h to node/deps/uv/include
- enter libseccomp dir
CC=$YOUR_PATH/x86_64-linux-musl-native/bin/gcc CXX=$YOUR_PATH/x86_64-linux-musl-native/bin/g++ ./autogen.sh
CC=$YOUR_PATH/x86_64-linux-musl-native/bin/gcc CXX=$YOUR_PATH/x86_64-linux-musl-native/bin/g++ ./configure
make -j64
- enter libseccomp/src/.lib,copy libseccomp.a to musl's lib dir.
- modify node's configure.py,add '-lseccomp' to
libraries
- run configure in node dir,
CC=$YOUR_PATH/x86_64-linux-musl-native/bin/gcc CXX=$YOUR_PATH/x86_64-linux-musl-native/bin/g++ ./configure --without-inspector --without-intl
make -j64
need LD_PRELOAD to specify dynamic libraries's loading path, two methods:
- in terminal:
export LD_LIBRARY_PATH=$YOUR_PATH/x86_64-linux-musl-native/lib
- add to .zshrc:
export LD_LIBRARY_PATH=$YOUR_PATH/x86_64-linux-musl-native/lib
run node's out/node
CC=$YOUR_PATH/x86_64-linux-musl-native/bin/gcc CXX=$YOUR_PATH/x86_64-linux-musl-native/bin/g++ npm install --nodedir=$YOUR_PATH/node_musl_sec/node ./seccomp_demo
NOTICE: nodedir is a directory,which contains node.js's source code.
Complete evaluation results are shown in the following items:
- Table 5 HODOR granularity of packages at system call level and thread level (RQ1).pdf
- Table 6 Exploit execution for packages with arbitrary command execution attacks.pdf
- Table 7 Exploit execution for packages with arbitrary code execution attacks.pdf
- Table 8 Vulnerability payloads.pdf
- Table 9 Engine-required system calls.pdf
- Figure 9 The relationships between line coverage and syscall numbe.pdf