Archive for the ‘Shellcoding’ Category

Linux x86 Shellcoding – 104   2 comments

  • Post Info:
    1. # Author: Flavio do Carmo Junior aka waKKu
      # URL: Author’s Webpage
      # Date: April 29, 2011
      # Category: Assembly, Exploiting, Programming, Security, Shellcoding

    Me again ;)…

    This is our 4th article in serie “Linux x86 Shellcoding”, I strongly advise you check others three if you still didn’t.

    Well, this post ended up much bigger than I expected but I hope you can follow and enjoy it.

    1. Introduction
    What’s our objective today?
    — Instead of write assembly instruction directly in memory we’ll inject carefully computed hexadecimal values within ASCII codes range that once executed will decode into our REAL shellcode. After we decode this new shellcode we still need to jump to its position and execute it.

    2. Planning – Phase 1
    Read the rest of this entry »

    Posted April 29, 2011 by waKKu in Assembly, Exploiting, Programming, Security, Shellcoding

    Linux x86 Shellcoding – 103   Leave a comment

  • Post Info:
    1. # Author: Flavio do Carmo Junior aka waKKu
      # URL: Author’s Webpage
      # Date: April 29, 2011
      # Category: Assembly, Exploiting, Programming, Security, Shellcoding

    Namaste…

    This is our 3rd article in serie “Linux x86 Shellcodes”, I strongly advise you check others two if you still didn’t.

    Today we’ve a new and interesting challenge, a much more elaborated shellcode…

    1. Introduction
    As I promised in our last talk, today we’ll use “CALL + POP” technique to put strings onto stack.
    Assembly is going to be a bit more “complex”, but not too much.

    Shellcode Objective: Create a new user with root powers (uid = 0) into the system.

    Considerations:
    – Linux stores its users and password in /etc/passwd file*
    – Password is generated using crypt(3) and MD5-based hash.
    – We need to append a new “customized” line in this file, using assembly.
    * Linux will only use /etc/shadow file if the password field into /etc/passwd is “x”, if the password hash is already available Linux authenticate it directly.

    man 5 passwd
    Read the rest of this entry »

    Posted April 29, 2011 by waKKu in Assembly, Exploiting, Programming, Security, Shellcoding

    Linux x86 Shellcoding – 102   5 comments

  • Post Info:
    1. # Author: Flavio do Carmo Junior aka waKKu
      # URL: Author’s Webpage
      # Date: April 29, 2011
      # Category: Assembly, Exploiting, Programming, Security

    Hi again…

    The objective for our shellcode today is execute the following syscall:
    execve(‘/bin/bash’, [ ‘/bin/bash’, 0x00 ], [ 0x00 ])

    1. Intelligence Gathering

    We are going to consider 0x00, 0x0d and 0x0a as bad chars.

    A. Our syscall specification:
    man 2 execve

    SYNOPSIS
    #include <unistd.h>

    int execve(const char *filename, char *const argv[],
    char *const envp[]);

    DESCRIPTION
    execve() executes the program pointed to by filename. filename must be either a binary executable, or a script starting with a line of the form “#! interpreter [arg]”. In the latter case, the interpreter must be a valid pathname for an executable which is not itself a script, which will be invoked as interpreter [arg] filename.

    argv is an array of argument strings passed to the new program. envp is an array of strings, conventionally of the form key=value, which are passed as environment to the new program. Both argv and envp must be terminated by a null pointer. The argument vector and environment can be accessed by the called program’s main function, when it is defined as int main(int argc, char *argv[], char *envp[]).
    […]

    Then we have:
    Read the rest of this entry »

    Posted April 29, 2011 by waKKu in Assembly, Exploiting, Programming, Security, Shellcoding

    Linux x86 Shellcoding – 101   3 comments

  • Post Info:
    1. # Author: Flavio do Carmo Junior aka waKKu
      # URL: Author’s Webpage
      # Date: April 16, 2011
      # Category: Assembly, Exploiting, Programming, Security, Shellcoding

    Hi everyone…

    Some days ago we were chatting at #dclabs channel about this blog and people asked for some posts about shellcoding
    Well, I’m not an expert in this subject but I’ll try to write all I know and sometimes we’ll be learning together, writing and reading these posts ;).
    Nowadays is pretty unusual when we really need to write our own shellcode, we can always go to MetaSploit Framework and grab a fresh one there, well written, reliable and even encoded. Well, where is the fun of it, huh?… I like to know where everything is and why, I promise that on the end of our saga you’ll be able to understand every detail about shellcoding and write your own shellcode, able to exploit a vulnerability that before was not exploitable using metasploit shellcodes.

    1. Introduction
    First of all, what is ShellCode?
    Read the rest of this entry »

    Posted April 16, 2011 by waKKu in Assembly, Exploiting, Programming, Security, Shellcoding