Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
All about the stack
  • chroniccommand
    Posts: 1,389
    [------------------------------------------]
    Paper name: All about the stack
    Written by: Chroniccommand
    Written for: iExploit
    [------------------------------------------]

    First, I must explain a bit about what the stack is. The stack is considered a "data structure", in computer science terms. It is a "Last In First Out", or LIFO data type. The stack has to basic functions. PUSH and POP. Think of the stack as a Pez dispenser. The PUSH operation pushes another item to the top of the stack. Just like adding more Pez into a Pez dispenser. The POP operation pops, or removes an item from the top of the stack, and returns the value to the caller. The stack elements have an order they go in, because of the PUSH/POP operations. Items are removed from the stack in the reverse order to the order of their addition(Using the POP operation).

    History of the stack
    The stack was proposed by Friedrich L. Bauer, in 1955(Then patented in 1957).

    Exploitation
    The stack can be exploited with things such as Buffer OverFlows. This is why it is sometimes called "Smashing the stack". Here is a diagram representing the stack:
    http://farm2.static.flickr.com/1350/1490540282_c96252968c.jpg
    C and C++ have stack classes in their standard library(Restricted to PUSH/POP operations). Java has a library that is like this too.

    Structure
    There is a set structure to a stack you should know. It is an area of computer memory with a fixed point to it. At the beginning, the size of the stack equals zero. The Stack Pointer(SP) points to the most recent referenced memory address in the stack(SP is usually in the form of a hardware register). When the stack has the size of zero, the SP points to the stacks origin. Like explained above, there's two standard stack operations. PUSH and POP. Some environments may rely on stacks a lot and have other functions.

    Dup - Duplicate. The first item is popped, then pushed two times again, so a copy of the original lays on top of it.

    Swap - The two upmost items in the stack change their places.

    Peek - The topmost item is returned, but the SP is not changed. Also, the size of the stack hasn't changed.

    Take a look at this stack image: NOTE: Image was too big to be placed here.
    http://upload.wikimedia.org/wikipedia/e ... Stack2.png
    Hopefully, this represents it clearly.

    I hope this helped you understand the very basics of a stack. I hope to write more advanced papers on stacks, and their exploitation soon enough.

    --Chroniccommand
  • Xin
    Posts: 3,251
    Nice paper! :) , good job xD
    Xin
  • chroniccommand
    Posts: 1,389
    Thanks. Knowledge of the stack is required for exploitation.
  • Bursihido
    Posts: 406
    thanks for sharing ur knowledge :D :)