Skip to content

Commit 0a21491

Browse files
committed
patch vuln in static router
credit to liquidcake1 for discovery
1 parent 62bed4a commit 0a21491

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core.sh

+8
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,14 @@ writeHttpResponse() {
381381
end_headers
382382
return
383383
fi
384+
REALPATH="$(realpath --relative-to="./static" "$FILE_PATH")"
385+
FIRST_THREE="${REALPATH:0:3}"
386+
if [[ "$FIRST_THREE" == "../" ]]; then
387+
respond 403 FORBIDDEN
388+
end_headers
389+
return
390+
fi
391+
debug "$REALPATH"
384392
respond 200 OK
385393
if [[ "$REQUEST_PATH" == *".css" ]]; then
386394
header Content-Type "text/css"

0 commit comments

Comments
 (0)