{"id":292,"date":"2019-03-01T13:45:22","date_gmt":"2019-03-01T18:45:22","guid":{"rendered":"https:\/\/blog.lamarranet.com\/?p=292"},"modified":"2019-08-28T10:32:11","modified_gmt":"2019-08-28T14:32:11","slug":"journey-to-oscp","status":"publish","type":"post","link":"https:\/\/blog.lamarranet.com\/index.php\/journey-to-oscp\/","title":{"rendered":"Journey to OSCP"},"content":{"rendered":"\r\n<p class=\"amlamarra\">This post will serve as record of my journey to obtaining the Offensive Security Certified Professional (OSCP) certification (and because I&#8217;m pretty sure it&#8217;s a requirement to write a blog post about it). I plan to continuously update this as I progress through the course and eventually (hopefully) obtain this coveted certification (EDIT: So much for continuously updating. I simply spent all of my free time working towards this cert). I won&#8217;t be discussing any details of the lab or exam as that&#8217;s a big no-no. However, I will be discussing my experiences, how I prepared, and what works for me.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Why?<\/h2>\r\n\r\n\r\n\r\n<p>I&#8217;ve always loved computers. I went to college for computer science as I thought I wanted to be a programmer. For some reason, I changed my mind &amp; decided that while I do like coding, I don&#8217;t think I&#8217;d like to do it as a full-time job. So after college I didn&#8217;t know what I wanted and just got a job doing what I knew how to do, fix computers. After working a help-desk job for a while I eventually started doing systems administration work. I should also mention that I joined the Air National Guard right after high school. A few years ago our unit started the process of standing up a brand new cyber squadron. As I was currently doing help-desk work in my Guard unit (and not enjoying it), I decided to switch to this new squadron. This also afforded me the opportunity to get my first taste of cyber security. I attended Operation Cyber Shield, a blue team training exercise. I managed to get on red team. This gave me my first taste of Kali Linux, Metasploit, nmap, etc. And I loved it! Ever since then, I&#8217;ve been doing everything I could to learn more about security. I&#8217;ve also had a fascination with penetration testing. Once I learned there was a cert that had you do an actual pentest as an exam, I&#8217;ve had my eye on it. But I wanted to be prepared. So for the next few years, I would sporadically do CTFs.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">And so it begins&#8230;<\/h2>\r\n\r\n\r\n\r\n<p>As of writing this paragraph, it is Friday, March 1st 2019. Earlier this week I got registered for 30 days of lab time and will be obtaining my lab access starting March 17th. On that day, I&#8217;ll get my course material and access to the lab environment. I started with 30 days since I do have some experience with CTFs. I&#8217;ve done a bunch of Vulnhub VMs, HackTheBox machines, and a few of SANS Holiday Hack Challenges. If I do need to buy an extra 30 days, it&#8217;ll only cost $50 more than if I were to have purchased 60 days from the start.<\/p>\r\n\r\n\r\n\r\n<p>In the mean time, I&#8217;m brushing up on some missing knowledge (e.g., getting shells via SQLi) by reading the book <u>Intermediate Security Testing with Kali Linux 2<\/u> by Daniel Dieterle as well as going through this great tutorial on buffer overflow vulnerabilities: <a href=\"https:\/\/github.com\/justinsteven\/dostackbufferoverflowgood\">https:\/\/github.com\/justinsteven\/dostackbufferoverflowgood<\/a><\/p>\r\n\r\n\r\n\r\n<h3>Friday, May 3rd, 2019<\/h3>\r\n<p>My original idea of updating this post along the way went out the window. With only 30 days of lab time, I ended up cramming a lot to prepare for the exam. Who knew that having a 3-year-old to watch and a pregnant wife to take care of would suck up so much time?<\/p>\r\n<p>I took my exam last week on Thursday and got an email on Sunday morning saying that I had passed! A much faster turn-around than I was expecting. For the exam, you&#8217;re required to write a report on how you exploited each of the 5 machines (IF you were able to exploit each of them). You also have the option of submitting a lab report, which includes how you rooted no less than 10 machines and the answers to the exercise questions in the course material. You can get an extra 5 points on your exam score with this report.<\/p>\r\n<h2>Preparation<\/h2>\r\n<p>While I opted to create and submit the lab report, I almost wish I hadn&#8217;t spent the time on it and just practiced on the lab machines instead. I kept seeing posts on the OffSec forums &amp; the OSCP sub-reddit from people that either barely passed because of their lab report or <em>would have<\/em> passed if they had done it. I believe I fall into the former category. While the PWK course material is great content, especially if you&#8217;ve never done this sort of thing before, it doesn&#8217;t really prepare you for the exam. The best way to prepare for the exam is to work on the lab machines. I spent a good 2 weeks on answering the exercise questions, which only left me 2 weeks to work on the lab machines. If it weren&#8217;t for my prior experience in working on VulnHub &amp; HackTheBox machines, I&#8217;m sure I would not have passed with only 30 days of lab time.<\/p>\r\n<h2>Exam Day<\/h2>\r\n<p>I woke up at 6 am on exam day and went through my normal morning routine to help my wife with getting the kid ready for day care. I started the exam at 8 am. My first task was to fire up <a href=\"https:\/\/github.com\/Tib3rius\/AutoRecon\">AutoRecon<\/a> to start scanning the 4 main machines, then start working on the Buffer Overflow machine. The BOF machine took about 45 minutes and by the time I was done, I had a bunch of scans to read through. About 6 hours into the exam, I hit a wall. I had rooted the BOF machine and got a low privilege shell on 3 others. For the next 12-16 hours, I got, virtually, nowhere. Finally, after a fresh cup of coffee and a few more tweaks to an exploit, I rooted the 10 point machine (yes, the easiest one&#8230;). Shortly after that, I was able to get a low privilege shell on the last machine and didn&#8217;t have much time to try to escalate privileges on that. So by the end, I had rooted the 10 point &amp; a 25 point machine, and got a low privilege shell on the two 20 point machines as well as the other 25 point machine. I can&#8217;t help but wonder if I would have done better on privilege escalation if I didn&#8217;t spend so much time on the lab report&#8230;<\/p>\r\n<p>My best advice for the exam is to think outside the box. While I hate that advice as it doesn&#8217;t really help anyone, it&#8217;s the best I&#8217;m allowed to do. The exam really makes you think. There&#8217;s plenty of rabbit holes and nothing is as easy as &#8220;discover service, get version, find exploit, and execute script to get shell.&#8221; Though I will say the buffer overflow portion is the most straightforward thing on the exam.<\/p>\r\n<h2>Tools<\/h2>\r\n<p>I just wanted to list a few of the tools that I found invaluable for both the exam and the lab machines.<\/p>\r\n<h3>Scanning &amp; Enumeration<\/h3>\r\n<p>As I mentioned before, <a href=\"https:\/\/github.com\/Tib3rius\/AutoRecon\">AutoRecon<\/a> is a great tool for enumeration. It&#8217;s incredibly noisy, so I wouldn&#8217;t use it in a real environment, but it&#8217;s great for OSCP or a CTF-like environment. It&#8217;ll nmap scan for all open ports and automatically enumerate the individual ports with additional tools. For example, it&#8217;ll run enum4linux when SMB is open or Nikto when an HTTP server is running.<\/p>\r\n<p>You may be familiar with <a href=\"https:\/\/github.com\/OJ\/gobuster\">Gobuster<\/a> to brute force search directories &amp; subdomains of websites. But for some reason, it won&#8217;t search for directories recursively. And maybe you&#8217;ve used <a href=\"http:\/\/dirb.sourceforge.net\/\">Dirb<\/a> to recursively search for web directories. If you want the speed of Gobuster and the &#8220;recursiveness&#8221; of Dirb, try <a href=\"https:\/\/github.com\/epi052\/recursive-gobuster\">Recursive-Gobuster<\/a>.<\/p>\r\n<h3>Exploitation<\/h3>\r\n<p>Any time I&#8217;m able to upload a file to a website running PHP, my go-to tool for getting a reverse shell is <a href=\"https:\/\/github.com\/pentestmonkey\/php-reverse-shell\">php-reverse-shell<\/a> from Pentestmonkey.net.<\/p>\r\n<p>Working on the OSCP lab machines, I used msfvenom a lot to create a reverse shell payload. To help cut down on the amount of time looking at help output from the tool itself, I used the <a href=\"https:\/\/pentest.ws\/tools\/venom-builder\">MSF Vemon Builder<\/a> from PenTest.WS. You&#8217;ll need to create a free account on their site, but it&#8217;s well worth it. From their site: &#8220;<a href=\"https:\/\/pentest.ws\/\">PenTest.WS<\/a>\u00a0is a penetration testing web application for organizing hosts, services, vulnerabilities and credentials during a penetration test. A reporting module is available for documenting and delivering a full penetration test.&#8221; The MSF Venom Builder is basically a GUI tool to craft an msfvenom command as well as to start a listener in msfconsole.<\/p>\r\n<h3>Privilege Escalation<\/h3>\r\n<p>Once I got access to a machine, there were several scripts I would use to enumerate the system to look for ways to escalate privileges. On Linux systems, I would use <a href=\"https:\/\/github.com\/rebootuser\/LinEnum\">LinEnum<\/a>. For Windows systems that have PowerShell, I used <a href=\"https:\/\/github.com\/PowerShellMafia\/PowerSploit\/blob\/master\/Privesc\/PowerUp.ps1\">PowerUp<\/a>. On systems that don&#8217;t have PowerShell, I&#8217;d use <a href=\"https:\/\/github.com\/M4ximuss\/Powerless\">Powerless<\/a>.<\/p>\r\n<p>Obviously, there&#8217;s a lot more tools I used, but these are my most common ones.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>This post will serve as record of my journey to obtaining the Offensive Security Certified Professional (OSCP) certification (and because I&#8217;m pretty sure it&#8217;s a requirement to write a blog<a href=\"https:\/\/blog.lamarranet.com\/index.php\/journey-to-oscp\/\" class=\"more-link\"><span class=\"readmore\">Continue reading<span class=\"screen-reader-text\">Journey to OSCP<\/span><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-292","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":13,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":446,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/posts\/292\/revisions\/446"}],"wp:attachment":[{"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lamarranet.com\/index.php\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}