I'm really into hacking and security aspects. But I'm wondering about several things that is stopping me from pursuing this passion for the time being. One of the them is actually Programming language. As we all know that programming in general is an open-ended field, and what I mean you can't just by learning the basics of a language go into writing complex programs or exploitations As an example, http://www.exploit-db.com/exploits/29290/ this exploit was written by C, even though I did study C long before. I can barely understand the code.

Therefore, I'm planning on learning C, Python, and IA-32 as a start for the upcoming period. But after I mastered the basics, where to go to focus on programming as a part of information security not just a regular programmer.

My goal and aim is to read and understand the above exploit, and be able to write a similar exploitation (buffer overflows in general). Also, to be able to find and exploit such weaknesses, do I have to also understand systems internals ??

Also, I've heard that the above exploitation has something to do with socket programming under linux enviroment, and ANSI C what are those and why do I need them to write such an exploit?

closed as too broad by Ayrx, TildalWave, Adi, AviD Dec 25 '13 at 12:23

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • The linked exploit does not exploit some kind of buffer overflow but a design flaw, where the php-cgi binary is publicly accessible, and can be trigger with command line parameters, which allows the execution of arbitrary PHP code. – Gumbo Dec 25 '13 at 9:59
  • Consider looking into the book violent python. – KDEx Dec 25 '13 at 22:51

To address your first concern. Understanding the code you linked to would be difficult to understand your first time through. You would have to digest the entry point, payload, exploit, and other nuances. This isn't wimpy code that multiplies two numbers and returns the result. It makes sense that someone with limited experience is unable to understand it.

Unfortunately, mastering the basics is not enough. For example, mastering the basics will not allow you to understand the code you linked to. Modern programming languages are designed in such a way that the basics are understandable to people who don't fully understand the language.

If you want to fully understand the exploit, the payload, the code, and learn the most about exploits, then you will need to fully understand a few things.

  1. How memory works (character encodings, the stack, and buffer overflows)
  2. C
  3. The platform the exploit is for. Do you plan on writing your shellcode for windows or Linux?...because there is a big difference.
  4. Understanding what happens when you compile and run a program

If I were you, I would start with the K&R C book. This will help you learn about memory and C. I would then read Programming From the Ground Up. This will help teach you about what happens when a program is ran and the connection between the source code you write and the instructions your computer executes.

Although I believe this is the best way to get started, it is certainly the hard way to get started...The material is very dense and difficult to understand. Understanding this stuff takes a lot of time and effort. Also, your knowledge-base will still have glaring deficiencies. Even so, if you get through this you will easily be able to understand what the exploits you find are doing and how they work after some examination

  • Thank you for your reply buddy, I really I appreciate it. OK what about learning a programming language from a hacker's or security prospective, what should I cover rather than the basics in a programming language in general?? – user209337 Dec 25 '13 at 12:11
  • This might be a little different answer. You might want to look into scapy and python because the two together will allow you to write pretty powerful code, that probably won't be a bufferoverflow, that does something pretty neat. Starting learning exploits and what not is very hard. You need a solid base to build off of – user11869 Dec 25 '13 at 14:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.