aslr

Is there some sort of ASLR protection on Android?

折月煮酒 提交于 2019-12-06 06:53:39
问题 I want to know if someone could access libraries with function addresses that would be the same from one instance of the program to the other? 回答1: The address space layout will be pretty consistent from run to run on the same device. A lot of the major system libraries are preloaded by zygote, and so inherited as shared mappings by the children it forks off to differentiate into applications. I suppose remapping them at the virtual memory level would be possible, but would incur a sort of

Exploiting a string-based overflow on x86-64 with NX (DEP) and ASLR enabled

走远了吗. 提交于 2019-12-06 01:27:36
问题 Consider the following vulnerable code/program: #include <string.h> int main(int argc, char *argv[]) { char buf[16]; strcpy(buf, argv[1]); return 0; } On IA-32 (x86, 32-bit) running Linux with NX and ASLR enabled, I would exploit this using GOT-overwrite technique, which essentially includes the following steps: Overflow buffer till RIP Overwrite RIP with the address of strcpy@plt Use a clean gadget from .text , e.g. pop edi ; pop ebp ; ret , as return address for strcpy Write arguments for

Why does the stack have to be page aligned?

人走茶凉 提交于 2019-12-05 18:16:04
In Linux, I've tried (just for fun) to modify the kernel source in process.c create a stack address that has more entropy, i.e. in particular the line: sp -= get_random_int() % 8192; When I change this too much, the kernel halts or I get some seemingly undefined behavior. I'm guessing that this causes PAGE_ALIGN() to fail in some way? I'm not that interested in why PAGE_ALIGN() in particular fails, or exactly what piece of code in the kernel that fails (although that too would be nice to know); I'm more interested in why the stack must reside in a particular region at all. What is the

Address Space Layout Randomization( ALSR ) and mmap

ぃ、小莉子 提交于 2019-12-05 10:42:34
I expect that due to Address Space Layout Randomization (ALSR) a process forked from another process will have different addresses returned when calling mmap . But as I found out, that was not the case. I made the following test program for that purpose. All the addresses returned by malloc are exactly the same for the parent and the child. Note that the malloc for cl1 , cl2 , pl1 , pl2 internally uses mmap because they are large blocks. So, my question is, why mmap is not returning different addresses even in the presence of ALSR. Maybe its because the seed for randomization here is the same

Address Space Layout Randomization in C Compilers

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 07:52:47
If I am not mistaken, ASLR will make the local variables in C compilers have a different address each time I run the program. But when I tried it in Turbo C++ and Dev-CPP IDE, it just returns a similar address for local variables. The code i tried: #include <stdio.h> #include <conio.h> int main() { int x = 10; int *ptr = &x; printf("%d", ptr); getch(); return 0; } Before, I thought the address of the local variables are the same because it is allocated in the same stack area and thus the same memory address. But when i found a thread here in stackoverflow about ASLR, it made me did these. I

Enable Safe Exception Handling in C++ Builder

北战南征 提交于 2019-12-05 00:10:06
For Windows 8 application certification, there are (among other) these requirements: 3.2 Your app must be compiled using the /SafeSEH flag to ensure safe exceptions handling 3.3 Your app must be compiled using the /NXCOMPAT flag to prevent data execution 3.4 Your app must be compiled using the /DYNAMICBASE flag for address space layout randomization (ASLR) I wasn't able to find out how to enable either of these in C++Builder XE. For /NXCOMPAT and /DYNAMICBASE , one can use editbin.exe from VS or peflags.exe from Cygwin. Though I would feel more confident about possible side-effects, if there

Is there some sort of ASLR protection on Android?

喜欢而已 提交于 2019-12-04 13:04:02
I want to know if someone could access libraries with function addresses that would be the same from one instance of the program to the other? The address space layout will be pretty consistent from run to run on the same device. A lot of the major system libraries are preloaded by zygote, and so inherited as shared mappings by the children it forks off to differentiate into applications. I suppose remapping them at the virtual memory level would be possible, but would incur a sort of dynamic-re-linking penalty and would be fairly tricky to implement. 来源: https://stackoverflow.com/questions

Heap randomization in Windows

帅比萌擦擦* 提交于 2019-12-02 18:15:21
问题 Windows 7 has Heap randomization and Stack randomization features. How could I manage it? How they are affects performance of my application? Where I could find more information on how it works? I'm using Visual Studio 2008 for developing C++ programs. I can't find any compiler's options for that features. 回答1: Ok, Heap randomization and Stack randomization are Windows features, but have to be explicitly enabled for each process at link time. Mark Russinovich described how it is work in his 5

Heap randomization in Windows

为君一笑 提交于 2019-12-02 08:56:24
Windows 7 has Heap randomization and Stack randomization features. How could I manage it? How they are affects performance of my application? Where I could find more information on how it works? I'm using Visual Studio 2008 for developing C++ programs. I can't find any compiler's options for that features. Ok, Heap randomization and Stack randomization are Windows features, but have to be explicitly enabled for each process at link time. Mark Russinovich described how it is work in his 5-th Windows Internals book. Stack randomization consists of first selecting one of 32 possible stack

How do I enable DEP or ASLR for my .NET application?

自闭症网瘾萝莉.ら 提交于 2019-12-01 17:25:55
I'm writing my program in VS2010 and the build target is .NET 4. I believe that the DEP compatibility flag is on by default. Is that true? Is .NET also compatible by default with ASLR , and is ASLR turned on by default for my process, or do I have to request it at runtime? Yes, the NXCOMPAT flag is turned on by the standard .NET language compilers since .NET 2.0 SP1. ASLR is essentially automatic in .NET programs by virtue of the JIT compiler. Where it will place the JIT compiled machine code is unpredictable. Albeit that it will likely be repeatable on the exact same machine with the exact