From f6acc9324044cfbf49218fd889d92d4cf706ff4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udio=20Silva?= Date: Tue, 6 Aug 2024 08:28:40 -0300 Subject: [PATCH] fix: check preconditions before running exploit code for the solidity bounty (#126) * fix: check preconditions before running exploit code * fix: change to check only for expected return codes --- tests/bounties/solidity-bounty/start.sh | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/bounties/solidity-bounty/start.sh b/tests/bounties/solidity-bounty/start.sh index e7731c3..c47ccdd 100755 --- a/tests/bounties/solidity-bounty/start.sh +++ b/tests/bounties/solidity-bounty/start.sh @@ -1,4 +1,31 @@ #!/bin/sh + +# +# Validate exploit code - Exploit code file must contain only ascii characters +# +grep -q "[^[:print:]]" $1 +status=$? +if [ $status -ne 1 ]; then + >&2 echo "Invalid exploit code: Error searching for non-ascii characters" + exit 1 +fi + + +# +# Validate exploit code - No experimental directives are allowed +# See: https://github.com/ethereum/solidity/issues/15223 +# +grep -q "experimental" $1 +status=$? +if [ $status -ne 1 ]; then + >&2 echo "Invalid exploit code: Error searching for 'experimental' keyword" + exit 1 +fi + + +# +# Run the exploit code +# ./solc $1 status=$? # Status is always 139 when program crashes with "Segmentation fault" (SIGSEGV)