Skip to content

Commit 3d9254a

Browse files
authored
Merge pull request tariqbuilds#448 from conmarap/447-fix-code-injection-vuln
tariqbuilds#447 - Make sure the module is a valid function in the bash file
2 parents 12d3817 + b333955 commit 3d9254a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/server/linux_json_api.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@ upload_transfer_rate() {
622622
}
623623

624624
user_accounts() {
625-
626625
result=$($AWK -F: '{ \
627626
if ($3<=499){userType="system";} \
628627
else {userType="user";} \
@@ -640,4 +639,10 @@ user_accounts() {
640639

641640
fnCalled="$1"
642641

643-
${fnCalled}
642+
# Check if the function call is indeed a function.
643+
if [ -n "$(type -t $fnCalled)" ] && [ "$(type -t $fnCalled)" = function ]; then
644+
${fnCalled}
645+
else
646+
echo '{\"success\":false,\"status\":\"Invalid module\"}'
647+
fi
648+

0 commit comments

Comments
 (0)