Skip to content

Commit

Permalink
fix: check preconditions before running exploit code for the solidity…
Browse files Browse the repository at this point in the history
… bounty (#126)

* fix: check preconditions before running exploit code

* fix:  change to check only for expected return codes
  • Loading branch information
claudioantonio authored Aug 6, 2024
1 parent 100e4ce commit f6acc93
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/bounties/solidity-bounty/start.sh
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit f6acc93

Please sign in to comment.