There are a lot of great answers on here (Python/Ruby for general scripting, C/C++/ASM for reverse engineering, web stack technology for web application security, etc) -- but I wanted to focus on a slightly different approach. I've run security teams for the last six years or so, and it's surprising to some people how little programming is often involved in penetration testing and application security assessments. If…
Programming is a hard requirement for app pentesting.
Ask HN: What's the best programming language to learn for security?
21–30 of 54 posts
Re: Ask HN: What's the best programming language to learn for security?
#22Earlier quoted context omitted.
Programming is a hard requirement for app pentesting.
I believe his point was that while you need to be able to do it, at least to a certain level, it's not where the majority of your day is going to be spent. I'm not in the field so I don't know true that is, however. That was just what I got from his post.
Re: Ask HN: What's the best programming language to learn for security?
#23There are a lot of great answers on here (Python/Ruby for general scripting, C/C++/ASM for reverse engineering, web stack technology for web application security, etc) -- but I wanted to focus on a slightly different approach. I've run security teams for the last six years or so, and it's surprising to some people how little programming is often involved in penetration testing and application security assessments. If…
Programming is a hard requirement for app pentesting.
Re: Ask HN: What's the best programming language to learn for security?
#24I love a question with a simple right answer: (Ruby OR Python) AND C. You can skip C if you don't want to do low-level work (embedded, kernels, writing shellcode for memory corruption exploits). Only a small fraction of security people do this kind of work. You cannot skip (Ruby OR Python), even if you don't ever plan to do web work (which is a dumb plan anyways).
You don't necessarily need to be able to sit down and bang out quality C, but learning some C is a great way to understand how software works at a lower level than you'll get from Python or Ruby. On the other hand you can apply that understanding to more quickly and correctly understand what higher level code is doing and what risks it is taking.
If you don't already have a good theoretical background, learn some C. Something like C++ or even Rust would work for this too, but those introduce a lot more language concepts that you don't really need.
Re: Ask HN: What's the best programming language to learn for security?
#25Earlier quoted context omitted.
Programming is a hard requirement for app pentesting.
Programming, but not software engineering. For example, it can be merely a nuisance if the tools you write leak lots of memory, acceptable to parse XML with a regular expression, and not a problem at all if programs run entirely within an environment you control aren't themselves secure.
Re: Ask HN: What's the best programming language to learn for security?
#26I love a question with a simple right answer: (Ruby OR Python) AND C. You can skip C if you don't want to do low-level work (embedded, kernels, writing shellcode for memory corruption exploits). Only a small fraction of security people do this kind of work. You cannot skip (Ruby OR Python), even if you don't ever plan to do web work (which is a dumb plan anyways).
Second this, but want to add: You don't necessarily need to be able to sit down and bang out quality C, but learning some C is a great way to understand how software works at a lower level than you'll get from Python or Ruby. On the other hand you can apply that understanding to more quickly and correctly understand what higher level code is doing and what risks it is taking. If you don't already have a good theoreti…
I mean, learn Rust if you want to write Rust code. But for the objective I'm addressing with C, you need C.
Re: Ask HN: What's the best programming language to learn for security?
#27Could it be that the heart of a secure system has little to do with process-oriented thought, and much to do with declarative policy?
In fact, in a well designed system, that should be the case. Unfortunately, there are bugs in all systems, so process-oriented thinking will always have a place. But in big picture terms - the 'heart' of a security stance - you really do need to be thinking in this way, particularly at design time, and generally also as an attacker.
Unfortunately, a declarative (policy-driven) architecture is essentially useless unless you ensure the system actually follows policy... for instance, by actually generating it largely from policy. This degree of rigor is rare in practice, but highly desirable in theory.
If you want to ensure your skills target big picture, are applicable to building things and not just tearing them to pieces (which in the security world often decays in to a range of puerile one-upmanship as visible at most prominent industry events), you could consider specializing in this area. In that case, you would do well to learn about declarative DSLs (domain-specific languages) and learn some of the more common ones. Then, practice generating things (documentation, functional code, application-level proxies, protocol test suites, policy compliance test suites) from those definitions... the generation could be done in any language, though using something simple with lots of libraries would be smart (possibly go, ruby, python, even perl or php).
Just thought it was worth contributing a different perspective here.
Re: Ask HN: What's the best programming language to learn for security?
#28I love a question with a simple right answer: (Ruby OR Python) AND C. You can skip C if you don't want to do low-level work (embedded, kernels, writing shellcode for memory corruption exploits). Only a small fraction of security people do this kind of work. You cannot skip (Ruby OR Python), even if you don't ever plan to do web work (which is a dumb plan anyways).
Second this, but want to add: You don't necessarily need to be able to sit down and bang out quality C, but learning some C is a great way to understand how software works at a lower level than you'll get from Python or Ruby. On the other hand you can apply that understanding to more quickly and correctly understand what higher level code is doing and what risks it is taking. If you don't already have a good theoreti…
Re: Ask HN: What's the best programming language to learn for security?
#29Depends on what type of security you want to get into. General Pentesting: Python or something higher level. Lots of library and tool usage (i.e. scapy, nping, nmap, metasploit) Application Security: Learn frameworks more than languages. How to work inside of Rails, Spring, ASP, PHP stuff, etc. Common security bugs that exist in these codebases, how to fix them, and how to recognize them. It is more important here HO…
Also good to know are C and Java/JVM.
Re: Ask HN: What's the best programming language to learn for security?
#30We fail to learn. Heartbleed. GHOST. The Android 4.3 KeyStore. Etcetera, etcetera, etcetera.
C was and is magnificent, in its way. But we cannot afford its gargantuan, gaping security blind spots any more. It’s long past time to retire and replace it with another language.
[...]
So please, low-level programmers of the world, I beseech you (while, to be clear, also respecting you immensely): for your next project, try Rust rather than C/C++. There is no longer any good reason for today’s software to be as insecure as it is. Those old warhorses have served us well, but today they are cavalry in an era of tanks. Let us put them out to pasture and move on.
(Personally I'm rather neutral on the issue (I don't work with low-level languages), I just think it's good food for thought.)