exploit

Bash 'printf' equivalent for command prompt?

梦想与她 提交于 2019-12-06 00:49:44
问题 I'm looking to pipe some String input to a small C program in Windows's command prompt. In bash I could use $ printf "AAAAA\x86\x08\x04\xed" | ./program Essentially, I need something to escape those hexadecimal numbers in command prompt. Is there an equivalent or similar command for printf in command prompt/powershell? Thanks 回答1: In PowerShell, you would do it this way: "AAAAA{0}{1}{2}{3}" -f 0x86,0x08,0x04,0xed | ./program 回答2: I recently came up with the same question myself and decided

Write a simple C arbitrary code execution exploit on ARM Cortex-M3?

青春壹個敷衍的年華 提交于 2019-12-05 10:16:23
I'm trying to write a proof of concept in C that demonstrates code execution from a memory buffer in the stack on an ARM Cortex-M3. This will be useful to demonstrate that using the ARM MPU correctly can prevent such an attack. I figured a quick and dirty way to get some code into the stack is to copy it from a regular function and then use a goto to jump to it like so: static void loopit(void) { printf("loopit\n"); while (1); } void attack(void) { uint8_t buffer[64] __attribute__((aligned(4))); memcpy(buffer, loopit, sizeof(buffer)); goto *((void *) (int) buffer); } I would expect that when I

Format string bugs - exploitation

那年仲夏 提交于 2019-12-05 03:55:16
问题 I'm trying to exploit my format string bug, which lies in this program: #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> #include <stdio.h> #include <string.h> void foo(char* tmp, char* format) { /* write into tmp a string formated as the format argument specifies */ sprintf(tmp, format); /* just print the tmp buffer */ printf("%s", tmp); } int main(int argc, char** argv) { char tmp[512]; char format[512]; while(1) { /* fill memory with constant byte */ memset(format, '\0', 512

return to libc - problem

最后都变了- 提交于 2019-12-04 21:41:30
问题 I'm having problems with return-to-libc exploit. The problem is that nothing happens, but no segmentation fault (and yes I'm actually overflowing the stack). This is my program: int main(int argc, char **argv) { char array[512]; gets(array); } I'm using gets instead of strcopy, because my addresses start with 0x00 and strcpy thinks it's the end of a string, so I can't use it. Here are the addresses that I need: $ gdb main core (gdb) p system $1 = {<text variable, no debug info>} 0x179680

Executing shellcode stored in environment variable using buffer overflow

不打扰是莪最后的温柔 提交于 2019-12-04 19:18:05
I'm using the code below to try to execute some shellcode stored in an environment variable by overflowing the searchstring variable so that the return address of main contains the address of the anvironment variable. However, I get a segmentation fault before the printf command. #include <stdio.h> #include <string.h> void main(int argc, char *argv[]){ char searchstring[100]; if(argc > 1) strcpy(searchstring, argv[1]); else // otherwise searchstring[0] = 0; printf("Here"); } I compile the code using gcc -m32 -g -o overflow.o overflow.c -fno-stack-protector -z execstack in order to disable the

How to guard against Resource exhaustion and other vulnerabilities?

天涯浪子 提交于 2019-12-04 11:45:35
We happened to use IBM appscan http://www-01.ibm.com/software/awdtools/appscan/ against our java codebase, and it returned around 3000 high severity vulnerabilities. Most of them happen to be System Information Leak, which it thinks is happening when we print stack traces in the catch blocks, but we only print the filename and line number it is happening, enabling us to debug the code better. And some are about SQL injection, input validation etc. But, my question was about Resource exhaustion (file descriptor, disk space, sockets, ...), and it lists all instances of java.io.BufferedReader

why can't Javascript shellcode exploits be fixed via “data execution prevention”?

假如想象 提交于 2019-12-04 10:31:15
问题 The "heap spraying" wikipedia article suggests that many javascript exploits involve positioning a shellcode somewhere in the script's executable code or data space memory and then having interpreter jump there and execute it. What I don't understand is, why can't the interpreter's entire heap be marked as "data" so that interpreter would be prevented from executing the shellcode by DEP? Meanwhile the execution of javascript derived bytecode would be done by virtual machine that would not

execle() also specifies the environment. What does that mean?

北城余情 提交于 2019-12-04 10:03:33
I am reading a book called "Hacking: The art of exploitation" and I came across this paragraph: With execl(), the existing environment is used, but if you use execle(), the entire environment can be specified. If the environment array is just the shellcode as the first string (with a NULL pointer to terminate the list), the only environment variable will be the shellcode. This makes its address easy to calculate. In Linux, the address will be 0xbffffffa, minus the length of the shellcode in the environment, minus the length of the name of the executed program. Since this address will be exact,

PHP GET variable array injection

旧街凉风 提交于 2019-12-04 01:53:16
I've recently learned that it's possible to inject arrays into PHP GET variables to perform code execution? .php?a[]=asd&a[]=asdasd&b[]=$a That was the example I was given. I have no idea how it works and was wondering if this is even possible? PHP will parse the query string, and inject those values in the $_GET super-global array (same for $_POST if this was done in a form using POST, btw) . In your case, the $_GET array will contain this : array 'a' => array 0 => string 'asd' (length=3) 1 => string 'asdasd' (length=6) 'b' => array 0 => string '$a' (length=2) Each value passed in the query

Format string bugs - exploitation

谁说胖子不能爱 提交于 2019-12-03 20:30:35
I'm trying to exploit my format string bug, which lies in this program: #include <sys/types.h> #include <sys/uio.h> #include <unistd.h> #include <stdio.h> #include <string.h> void foo(char* tmp, char* format) { /* write into tmp a string formated as the format argument specifies */ sprintf(tmp, format); /* just print the tmp buffer */ printf("%s", tmp); } int main(int argc, char** argv) { char tmp[512]; char format[512]; while(1) { /* fill memory with constant byte */ memset(format, '\0', 512); /* read at most 512 bytes into format */ read(0, format, 512); /* compare two strings */ if (