[oss] [Lab 02][Task 5] mark .data as executable

Alex Teaca ionutalex.teaca at gmail.com
Sat Oct 25 18:14:11 EEST 2014


Hello,

Yes, it works. Also it works if the task5.c is compiled with 'gcc -z
execstack task5.c -o task5'.
I think it is the same thing, and the .stack zone will be executable, right
?
But I don't see how it works. I mean the .data section has only write and
alloc flags,
and the shellcode resides in this section.

Alex

From: Radu Caragea <sinaelgl at ...
<http://gmane.org/get-address.php?address=sinaelgl%2dRe5JQEeQqe8AvxtiuMwx3w%40public.gmane.org>
>
Subject: Re: [Lab 02][Task 5] mark .data as executable
<http://news.gmane.org/find-root.php?message_id=CAKxsPq%2bnS8AhhffQXU405KMcNziNBepZ%3dNoRb4uQ09%2bReuA7sg%40mail.gmail.com>
Newsgroups: gmane.education.region.romania.os.security
<http://news.gmane.org/gmane.education.region.romania.os.security>
Date: 2014-10-25 14:10:20 GMT (55 minutes ago)

Can you try and run "execstack -s task5" after compiling and check if it works ?



On Sat, Oct 25, 2014 at 5:06 PM, Alex Teaca <ionutalex.teaca at gmail.com>
wrote:

>
> Hello !
>
> For the task 5, I try to mark the .data section as executable.
> I tried in gdb to call the mprotect function:
>
> (gdb) call mprotect(0x0804a010, 4, 0x1|0x2|0x4)
> $1 = -1
> , where the 0x0804a010 is the address of .data section found with objdump.
> You see that mprotect returns error.
>
> Also, I tried to compile with -S flag, and update the task5.s with
> ".section .data,"awx", at progbits"
> but, when I compile, I get
>
> gcc -C task5.s
> test5.s: Assembler messages:
> test5.s:5: Warning: ignoring changed section attributes for .data
>
> and the .data section remains WA.
>
> So, how can I run code from .data section ?
>
> Thanks, Alex
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/oss/attachments/20141025/8e4845ff/attachment.html>


More information about the oss mailing list