flat assembler
Message board for the users of flat assembler.
Index
> Programming Language Design > [fasmg] gnu-stack |
Author |
|
_shura 26 Sep 2016, 16:18
Ohai,
I suggest to add Code: PT_GNU_EH_FRAME = 0x6474e550 PT_GNU_STACK = 0x6474e551 at the start of fasmg/examples/x86/include/format/elfexe.inc (the constant is from https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/progheader.html) and Code: else match =gnustack?, attribute SEGMENT_TYPE = PT_GNU_STACK else match =gnuehframe?, attribute SEGMENT_TYPE = PT_GNU_EH_FRAME in the macro segment? attributes*. Without the GNU-_STACK-segment it is possible to execute data by accident or malicious influence. Even if you try to protect it with mprotect! Here is an example: Code: include 'format/format.inc' format ELF64 executable entry _start segment executable _start: jmp outside return: mov rax, 60 syscall segment readable writeable msg db 'hello world', 10 msg.size = ( $ - msg ) outside: mov rdx, msg.size lea rsi, [ msg ] mov rdi, 1 mov rax, 1 syscall jmp return segment readable writeable gnustack Just try with and without the last segment. I do not know the purpose of the GNU_EH_FRAME-segment, but it may be usefull for someone.[/i] _shura (this was posted somewhere else by accident, sorry) |
|||
26 Sep 2016, 16:18 |
|
_shura 26 Sep 2016, 18:45
yay, thank you.
I would be nice , if you implement it in fasm too. |
|||
26 Sep 2016, 18:45 |
|
Tomasz Grysztar 26 Sep 2016, 19:06
_shura wrote: I would be nice , if you implement it in fasm too. |
|||
26 Sep 2016, 19:06 |
|
Tomasz Grysztar 26 Sep 2016, 20:09
OK, got it done for fasm, too.
|
|||
26 Sep 2016, 20:09 |
|
_shura 21 Aug 2017, 00:43
btw. could you add an gnustack-segment to the fasmg itself? I guess, it is not really necessary for the compiler, but it may prevent some vulnerabilities. A compiler is not really such an attack surface, but who knows?
|
|||
21 Aug 2017, 00:43 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.