So now it is the top of the hour. It is now 2 p.m. And it is my great pleasure to introduce to you, actually my half-co-author, happens to be my mentee at B-Side Las Vegas this year, Lokesh Pindewaker, who will talk about, you know, how you can learn hacking and hacking, the hacker's practice playground. So, without much ado, Lokesh. All right. Thanks, Ming, for the introduction. It's my pleasure to be here. It's my first DEF CON as well, so most of you, I saw a raise of hand that some of you are first to DEF CON, so that's great. I'm sharing the same experience as you all are sharing. So, thanks, thanks, packet hackers. Thank you, Hacking Village Wall of Sheep, for giving me opportunity to talk here about some of the things that I have done myself. So, a few days ago, I was talking at B-Sides about how I learned hacking, and Ming was there, who mentored me there. Here, I am talking about more on a practice ground, what one can do to learn hacking, and what hackers do in order to own their skills, in order to learn more, in order to improvise on their skills. So, let's begin. So, let me tell you what I'm going to tell you in the presentation. First, we'll start with why learning this, you know, why to learn hacking. Then, we'll start up with how we can create a lab environment, how we can learn techniques, the tricks, the trades. We'll talk about some of the caveats, and what are the opportunities that will come to you if you start practicing hacking, you know, if you start building your skills. And finally, we'll end up this talk with a little bit of a talk about the conclusion. And I'll be demoing some of the vulnerabilities, basic one. So, I just want to mention in the beginning that this is a very beginner's talk. So, if you are new to security, if you are trying to be, trying to learn new things, this is for you. So, let me begin with my introduction. Yes, I recently graduated from Northeastern University. I did my masters in information assurance. I started working as information security engineer. I blog at my infosec forever. And this is my Twitter address. So, let's begin. Customary disclaimer. All the tools and techniques that I'm going to show here, whether I'm talking about those techniques or I'm showing a demo, those are dangerous. And those are only for educational purpose. I'll not be liable if you use it for some nefarious purpose or anything. I'll not be liable, neither Wall of Sheep, or any of these presentations. Another thing is, it's illegal. If you try those things on your employer where you don't have permission or if you try those things in wild, it's completely illegal as per the federal laws or in some state laws as well. So, please use caution. Please get a written permission before trying out these tools. So, why learn this? Why have a practice ground for hacking? So, before trying out these tools, coming to hacking, let's start with something very specific to industry. That's pen testing. So, this is a cool definition from NIST. It talks about pen testing as a testing where assessors mimic real world attacks. Be it your network level attacks, infrastructure, system level, application, or even human. Nowadays, social engineering is a big, big, big thing while doing pen testing. So, it's where your assessors will work in order to get gauge the security of the system. So, why do we need pen testing in our organization or why do we need pen testing in our general life? The best reason is it's always better. It's cost-effective because if attacker will be able to exploit the whole, it'll be more expensive to fill that gap. Instead, just find it yourself, and it will be cheaper. The other reason is ways. You know, people are crazy about organizing. It's like, you know, there's a automated scanners, but they are not enough. They'll tell you a lot of false positives, but they are not enough. You have to go one notch up where you are trying things on your own because pen testing will never give you false positives. Sometimes it's required from your compliance standard. So take an example of PCI DSS. Last year, I think this year, they had specific guidelines on pen testing. So yes, if you are into compliance, if you are into PCI DSS, there's something that you should really look into. So that was from a pen testing side. Now coming back to the track of why we need our practice ground. So why? So as I mentioned in the disclaimer, you cannot just attack anyone in the wild. So that's where you need a ground where you can just practice your skills. Legally. The other reason is it's my, since I'm coming from a background, I just graduated from my school. So they don't teach how to break things. It's illegal to teach breaking things. But when you move from your school life to a corporate life, your employer will expect from you that you will be able to defend against all those sophisticated attacks, APTs and everything. So will you learn? You have never done anything. So this is where you will learn things. And the other thing that I noticed while I was giving interviews, while I was transitioning from my school days to industry is there's a strong need of security engineers, pen testers, and real practice is required. Real skills are required. You cannot just go in interviews with theoretical skills. So let me tell you how you will build your own lab. So recipe will include the basic stuff like you'll have some virtualization platform, some software that you'll use for attacking some software. Those are vulnerable because, again, the premise, legal. So those kind of things. And more important thing, the technique. You will need some mind. So beginning with the infrastructure, you can install it on Raspberry Pi, old laptop, anything. So let me tell you one simple thing. You can install it on a laptop. So let me tell you a story about myself. So I installed my first virtualization software on my old laptop. And that had a RAM of 256 MB. On the other hand, my phone has a RAM of 2 GB RAM. So think about the transition that technology has made over the years. So you can use anything to build your own lab. It will not cost you more money. About the software, there are a bunch of free software available like VirtualBox. But if you are not fortunate enough, like me, I was in Northeastern. Northeastern gave me free license of VMware Workstation. So that worked really well for me. Coming to attacking OS. So if you plan to attack something, you will need some kind of software to attack a specific vulnerability. Now there is one way to install each software one by one. Or on the other hand, you can just install a disability. You can install a server, you can install a distribution. Kali Linux is one of the popular, I'll say, distribution available in the market. And I think this week or next week, next week they are going to release the second iteration of Kali. Earlier it was known as Backtrack. And I've used it extensively from the Backtrack time 2, 3, 4, R1, R2, 5. But so Kali has a bunch of tools for all the things. Consider information gathering, vulnerability assessment, exploitation, forensics, or memory corruption, timing, stress testing, everything. So if you need a common operating system that covers all the tools, Kali is your go-to tool. But if you are planning to do something very specific, such as web application print testing. So I have more interest in web applications. So what will I do? Kali is good to go. But there are other options available. Samurai, on the other hand, concentrates more more on web application. It has bunch of tools available and vulnerable application installed, pre-installed, which are specific to web application vulnerabilities. Now coming to, again, one other story from my school days. So if you are into forensics, so when I took my forensics class, and I'm really honored that my forensics professor is also here, that when I took my forensics class, it has bunch of tools which were different. I have never used those tools in my life during trying out pen testing, but for that particular semester I had to concentrate more on forensics. So if I need to excel in forensics, I am concentrating more tools on forensics, Santoku is one of the good options available in the market. There are other attacking OS like Backbox, PenTube, Android, yes, because the age is getting mobile now, so we need to have some tools like Appy which can be installed on Windows or Android Tamer. Specifically, we need to have some tools like Appy which can be installed on Windows or Android Tamer. Specific to Android, that can be used for Android pen testing or mobile pen testing specifically. Now those were the tools of attack, you will need some software that are vulnerable in nature, pre-built with the vulnerabilities, the common vulnerabilities like SQL injection, cross-site scripting, buffer overflows, everything. So these are a few vulnerable platforms that I have used personally, and I found it very iterative to learn things on my own. Talking about Metasploitable, so it got upgrades, so earlier it was Metasploitable, now it's Metasploitable 2, coming from offensive security, the big vendors for security, they built this operating system with a bunch of vulnerabilities, web application vulnerabilities as well as network services are available there. So it's one of the things that you can install and start playing with your computer, and with your attacking tools on this. I'll show, in a few minutes, I'll be showing a demo of how you can exploit vulnerabilities on Metasploitable 2. But there are other vulnerable images available. So pen tested lab, Vulhub, they are giving out images specific to vulnerabilities. So last year when Heartbleed came, even I was very curious to try out Heartbleed attack, but I cannot try it on my own. Like just on any random site, I went to pen tested lab, I downloaded a specific image for this vulnerability, and started working on this. Same with web applications. When I was trying out to learn SQL injection, process tripping, I downloaded the, I started working on these and got to know more about it. One tool that I really want to mention is web code. Now the good thing about web code is it gives you a good function. It gives you a good function, it gives you a good format of lessons, and then the vulnerabilities. So you'll have lessons like injection, cross site scripting, and as you go through it, if you are stuck at some point, it has solutions. So you can just click on solution, try out those things, you'll learn it. The same way we have spoken about mobile application attacking software, we have vulnerable mobile applications like GoDroid, Insecure Bank B2, one of the applications my friend has created, I really want to mention. And this is a good application, both on Android, there is DVIA, damn vulnerable, iOS application that's on iOS platform. So these were the images or the vulnerable software that we spoke, were the things that you can install on your machine. But if you want to go cloud, hack.me in 2013, they released this platform, eLearn Security released this platform, and this is a cloud-based platform. You can just spin up your application, you can go to Apache or any database and start hacking that particular thing. It's a sandbox environment, completely safe, completely legal. So those are something that I use. This is a small glimpse of my laptop view. It has a bunch of attacking operating system, a bunch of vulnerable web applications as well. So till now we spoke about the tools or infrastructure, but this is not enough. Hacking is not point-and-shoot, so you just press that red button and it will, boom, no. You have to have fundamental. And one of the things that I have learned myself is going to OWASP. It is great resource about web application security. You go there. I still go there for small, small things because the way they have designed it, how to hide vulnerabilities and what is the vulnerabilities , and then how to mitigate it. Because as a security engineer, we need to be able to understand the vulnerability to know how to protect our application from certain vulnerabilities and OWASP is a great resource and that's where most of the people who are new to industry they make this misjudgment of just trying out tools just spinning off tools so that they learn it no you have to start from the fundamental you have to start from the basics so other other resources that I really go to our blogs every researcher put their research on blogs and that's another resource conference talks like this I got to learn more about things from conference talks videos most of the conference I was not able to go but these guys SecurityTube, IronGreek they put videos of conferences on their portals so that I can view them and learn things so I'll tell you another story from my network security practices class so there was an assignment on DOS attacks so I went to a my YouTube search about few of the DOS attacks and found Sam's talk on YouTube about a different vector for denial of service I use that and it got me extra points so that's one good thing so now that you have learned now we have learned how what are those softwares hardware and techniques it does not stop here once you know those things you need to start practicing again and again so it's not a matter of time it's not a matter of time it's not a matter of time it's not enough to know how to exploit a cross-site scripting vulnerability get creative try out different payloads it will give new directions you will get to know new things about that so always practice and dedicate your time so what something that I have found whenever we dedicate time to some technique we'll learn more about it so don't stop I just you know I achieved this no practice it again and again so let's go to demo the funniest part yeah I was just talking talking talking but I hope it's oh oh okay yeah it's visible perfect so this is I'm just talking up my VMWare and here's my Meta exploitable I've just started my Cali and I'll just show you a demo of how basic vulnerabilities can be exploited and you'll get to know that it's not that valid. tough to start learning about these things it's very easy to start the toughest part is to know the basics and to practice it again and again so dedication will be required so as I have mentioned metis ploidable is one of the vulnerable distributions so I'll just look for its IP address here we can see it's 192 168 15 and 131 it's our target that we have to our admission is to exploit this target as I mentioned we'll use Cali as our attacking software will just go to Cali and so when I was talking about metis ploidable I said it has bunch of applications web application network everything so let's start one by one so first is port scanning it's so if you are into industry if you know port scanning you the go-to tool the defector standard is nmap we can just in order to enumerate the services we can just write nmap 192 168 59.131 so nmap has multiple joints you you can use multiple options it gives very specific results in terms of scanning profiles like intense scan or if you just want no pink scan or something I'm not using any specific scan I'm just giving you a small demo of how easy it is to enumerate which ports are open what services are running but we can go into that detail so here you see that my nmap scan gave me this so these are the open ports available as you can see that FTP telnet I can easily choose my target that I'm going to exploit FTP or telnet or login VNC so these are things that I've already decided in my mind so my information gathering is done now I'll start searching for exploits and things so so in order to exploit people use metis ploidable even I use metis ploid a lot but in this demo I'll be demonstrating an interface for a metis ploid Armitage I'm sure some of you might be using this but I just wanted to show how easy it is to exploit some of the vulnerability if you know what exactly are you trying to do it will take some time to connect so in the meantime let's jump on to some of the features that I'm going to show you today. well ability so as I mentioned we have bunch of applications in metis ploidable to let's see what kind of applications we see here so I'm just accessing my metis ploidable from my host machines browser so it's very technical and you can see that it's very complicated as well it's very reliable. Here, I can see Matilide is one of the vulnerable applications, DVWA. So, let me show you DVWA. So, this is one of the vulnerable applications available. You can just download and start practicing about things. It has a bunch of vulnerabilities like SQL injection, RFI, LFI, cross-site scripting, command injection, everything. So, if you are really new to web application security, I highly recommend you to get this tool and try out different levels. It has different levels. And the other good thing about DVWA that I have found is, I read the source code just to understand what kind of things they are doing. What kind of things make it vulnerable and how to protect it. So, it has three levels, high, medium, low. Low is one level where it is completely vulnerable. Where high is... It's secure. So, just want to see how things can be secured. So, let me set the security level as low so that my vulnerabilities will work. And the basic one, if you talk to anyone, they'll give you... So, how to test cross-site scripting? So, I'll not put alert one as the first payload. It's quite easy because I already know that this is vulnerable to cross-site scripting. I'll just put script alert one and get an alert box. And it's cross-site scripting. But what is the method? The method is to see whether something is getting reflected from the server or not. So, let's try to see if something is getting reflected. If it is executing attacks or not. So, I'm putting it... I'm putting a tag as B just to bold. This will be bold. Let's see what happens. So, if you notice, this is different... And... Is it different? Yeah. So, this is... I don't know if you are able to make a judgment. Let me put it as italic just to make sure that... This... So, see here. It's reflecting something. So, something is happening. Now, we know that it's executing our scripts. And here... Here is the point where you can test whether it's actually vulnerable to cross-site scripting attacks. So, alert one gives you a proof of concept. I'll just show you. Document.cookie. And here you go. So, the same way you can try out cross-site scripting stored. Okay. So, some of that... Okay. So... So, here you can try out cross-site scripting. My favorite command injection. You can just see... What kind of commands you are executing on server. So... It's vulnerable to command injection. This is the way you do it. So, I think our... Yes. So... Yeah. I was taking that meantime just to introduce you to... So, web application security and how you can test it. Now, here I'm showing you this. So, what we did earlier, we did an Nmap scan to enumerate the services. In Armitage, you have two options. So, Metasploit also helps you in enumerating services. So, either you can use Metasploit's engine or Nmap engine to enumerate services. So, it has Nmap scan, different scans that I was talking about. And then you have MSF scans. So, I prefer to do both because it gives me more perspective about the target. But, you know, we can just do one also. That will also be enough. So, let me do it. Intent scan all TCP ports. This is my server. It started scanning. So, the other reason why I'm demonstrating Armitage is how easily you can see... So, you can see that there is a reverse bind shell connected to it or meter putter is executed. So, it's still executing. So, Nmap is running. It's enumerating. So, that gives us time for another demo. So, let's jump on to my favorite web code. For that, I have my favorite operating system available. Highly secured Windows XP. I have to watch what I'm reading there. People are taking questions. Just give me a few moments. So, any questions here in between? We can take... No questions here. Showing all the new stuff. So, the other thing that I'm going to discuss here is... demo is the web code how you can run it so web code is again coming from OWASP it is being developed in java and it has vulnerabilities in the form of lessons so quickly go i've just downloaded it from its link and i'm starting the apache server it uses tomcat as the observer so let me start it and then we can quickly go so as you see my server has started so it it it started it needs credentials we just log in with guest credential and it's contacting so as i was talking about these are in the left hand side you can see all the lessons if you just click on something it will do once you are done with one of the lessons it gives you green signals like okay fine you passed it so let's let's let's do something and the other thing is it has solutions show java something like if you want to know what is the source code of this vulnerable page it gives you a good look of the source code and you can actually see what is the vulnerability so let's see so here i'm just demonstrating a simple sql injection let's see john j smith all right so no matching records form so if i do this okay so here when when i when i'm able to exploit the sql injection i get a good message like congratulations you have done this and then whatever will and you if you notice here it gives you me it it gives me an check mark so that was all about webgoat try it out it's a good tool it's good to learn things so. Yeah, in the meantime our scan is complete. So even while doing the real-time pen testing, you know, you have to give time for your scans. In the meantime you can just try out different things to get more information. Once the scan is complete, we can just click on the console and we can see what kind of services are installed there. So we can see here FTP, the same thing that we... So let's try, let's search something related to FTP. Do we have anything running? Now it says vsftpd. So let's see if Metasploit has anything related to vsftpd. I can see one of the exploits available. So it's very easy to exploit this. You just need to drag it here, drop it on this. It will execute on this. It will ask you options, so if you have worked with Metasploit, you have to set certain options like what is the remote port or remote host. In this, we can set everything here, but as you see it already set the remote host as my Metasploit table IP address, so every option is already set up. It will not populate other things like username or password or anything else. So once we are done with the options, we can just say launch and it will start. Launching the... And if you notice, we got the root access and it changed the colors. And we get a new tab here, new setting here, which says shell. And here you go. We can interact with this, it's root. So we just exploited vsftpd on a vulnerable application. So here... This is how you can learn this. I was just searching for vsftpd. Sometimes it will work, sometimes it will not work based on the disconnect. So we can just search for find attacks. It will do a small query. It's not completely reliable, but yes, we can definitely do a small query of what kind of attacks can be possible on my target. And when you do that, you get... Another tab, which is attack. So it gives a suggestion of what kind of attacks can be possible and we can pick anything. Sometimes it will work, sometimes it will not work because this is just a suggestion from a heuristics point of view that these kind of attacks can be tried. So yeah, that's it from my demo site. Let's continue. So yes, so this... Till now we were talking about how we can set up our lab, how can we start learning about exploitation, how we can start learning about vulnerability assessments and everything. Now coming to real world, how we can learn in real world scenario, what kind of things are available and how we can learn new attack scenarios. Wargames and capture the flag competitions are good resources of experiencing the real world things. As you can see, even in Defcon, we have multi-task. We have multiple CTFs being organized. Participate in those kind of CTFs, you learn new things. But if you are not in a conference, how will you get involved in CTFs? Over the wire is one of the resources that I have used and I have been very successful with this in terms of learning things because it has multiple challenges based on web applications. So NetEase is one of the vulnerable web application challenge where it has level one, two, three. So first one will have some of the... Low level vulnerabilities, but as you go up, it will have more vulnerabilities. The other is like smash the stack. I have bunch of links just for the wargames and CTFs available globally on the internet. You can just contact me. I can give you a list of that. Apart from CTFs and wargames, nowadays I've seen from couple of years, people have started putting up challenges, online challenges on specific things. So last year, like last year, this screenshot, this screen capture is from... It's this game area that Google has put up. So last summer when I was interning, Google has put up a cross-site scripting challenge and it was a five level challenge. So I jumped onto it, tried different things, and finally I blogged it about how it is done. But the same way, other companies like Yahoo or Google Grower is one of the other application that I generally use. One good thing about these challenges is people write about the walkthroughs when they approach the challenges. So the way I have blogged my experience with the Exodus challenge that Google has put up, the same way other researchers also blog about their walkthroughs. So that helps fellow researchers. So I may not be able to get cross-site scripting payload within 15 characters or 11 characters, but I can revisit, I can visit others' walkthrough in order to get more understanding of that. And that's where Cure53's link comes into picture. It gives a good write-up of older challenges. It's based on cross-site scripting, what are the challenges that were put up in the past. They give a good walkthrough of what kind of payloads that they have used. And people submitted, people collaborated, and that's where I have learned most of my payloads, which I try to, you know, when there's a restriction, like a username field, it has a restriction of putting only seven characters. So I don't know if cross-site scripting is possible in seven characters, but yeah, those kind of things, maybe by encoding we can do that. So that brings me to another thing, you know, changing gears here. So we started with setting up our lab, then we learned how to exploit things, we started participating in CTFs, challenges, we are excelling at everything, and now suddenly we stumble upon a zero-day. So what will you do? So as a security practitioner, what I do is... I... I strongly believe in responsible disclosure. I have disclosed multiple critical vulnerabilities to vendors in the past. I do it regularly. So that's something that I recommend to everyone, because we are white hats at the end. So that's something. The other thing that it does, the responsible disclosure or coordinated disclosure, is it builds trust between the vendor and the community. So you don't need to threaten the vendor that I have got a critical bug in your system, and give me, like, $500 or something like that, otherwise I'll just disclose it, I'll exploit, or I'll just find out your user base, everything. So don't do that. Always try to build trust between vendors. And sometimes it gives you name and fame as well, and money. So since I was a student, it was a great resource to earn some good money out of bug bounty programs. So with this skill, it... I... I... I wanted to gain more exposure, more experience, and I started doing that. So I'll talk about that in a minute. So coming to the opportunity land, huge, huge opportunities, when you talk about information security and why we need... Why we need to learn hacking, because if you are with this kind of skill, people are ready to pay you a lot. And just to give you a brief glimpse, $100,000, it's huge. So coming to dollars, like, so I was talking about bug bounty programs. It's just good, because most of the companies have started putting up responsible disclosure pages on their web application just to communicate with the security researchers and awarding what they are trying to find out. And it started with, you know, Google and Facebook, they come early in the party, and now we have got... But specific platforms like Bug Crowd, Synac, or HackerOne, they... These are platforms where vendors put up their application for challenge, and security researchers from all over the globe, they try to exploit vulnerabilities in scope. And if it is a right vulnerability, it's a true positive, then vendor awards and awards ranges from anywhere between $10 to $35,000 or anything. I have disclosed multiple vulnerabilities to Sony, Prezi, Eventbrite, and that was, like, something that I still do it. And different programs offer different things. So for instance, I think a few months back, United launched a bug bounty program, and they are awarding miles, the flight miles. And so that's one of the good things. What bug bounty programs. But when one is trying to participate in bug bounty programs, there are some guidelines that I think I follow myself, and I recommend to everyone, because it's very important, and these guidelines will give you a big payout. And one of the good things, one of the things that is a main ingredient of getting a good payout is writing a concise report. Yeah. Even when we do formal pen testing, we try to write a concise report. So why not do the same thing with the bug bounty reports? So that's one of the things that will give visibility to the vendor. They'll be able to replicate the steps. The other thing is scope. As I mentioned earlier, just because the vendor has put up a site for you to exploit, don't exploit anything. Be in scope. So that's very important, because sometimes people get really annoyed when we try to go out of scope. And respect the vendor. Don't threaten them. So I'll tell you my experience. One of the bugs that I have reported last year in a password manager that got breached some time back, they fixed my bug last month. So it took around 12 months for them to fix a bug. But I never tried to threaten them. That's something that we need to follow. Respect them. And the last thing is don't copy-paste. There are a lot of cool bugs to find. Get creative and find something innovative, something new, something good. So don't copy-paste. And yeah, that's a few of the things that I generally recommend in order to excel in bug bounty programs. So this brings me towards the end of my talk, where let's discuss what we have discussed so far. 1. One of the key things is the security industry is growing exponentially. There are new kinds of vectors, attacks. Everything is happening so rapidly. And the skill development is really a key to excel in this industry. And one cannot develop skills just by going into a school or just by attending a workshop. It's a continuous process. You have to start on your own practice, and then you can excel. 2. The other thing is schools are good, classes are great, but they cannot teach everything in class. So, for example, my professor taught me how to do a SQL injection. But he cannot, he will not, you know, he will not be able to teach me all the ways because A, it's not feasible because of the time constraint and B, it's not in respect to the whole class because other people might not be interested. So you have to get that cue and then start developing on your own. The good thing about doing this is you get to know how to attack. And that makes you different because you'll be able to defend against more sophisticated attacks or even by sophisticated, the normal attacks. So that's one of the great things that once we have experience of exploitation, we'll be able to design better defenses. So that's one of the things. And that brings me to the end of my talk. These are a few of the references that I have. I hope you enjoyed it. Thank you. And any questions? Yes. Oh. Okay. Okay. Sure. Sure. So questions we'll have after the talk. All right. And thanks, thanks, thanks a lot to Wall of Sheep and having me here. Thanks a lot to Ming for spending time with me and giving me the mentorship. I'm really honored to have him. Thanks. Thanks a lot, guys. Thanks a lot for being here. Bye. Bye. Bye. Bye. Bye. Bye.