{"id":5376,"date":"2018-12-11T04:21:17","date_gmt":"2018-12-11T04:21:17","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=5376"},"modified":"2018-12-11T04:32:56","modified_gmt":"2018-12-11T04:32:56","slug":"pop-the-box-ls-blog","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/11\/pop-the-box-ls-blog\/","title":{"rendered":"Pop the Box \u2013 ls \/blog"},"content":{"rendered":"<p>Let[s] <a href=\"https:\/\/www.peerlyst.com\/tags\/talk\">talk<\/a> a little about this box. In this HTB machine we will see only one port is open and that will be the http one , we will fireup the dirbuster to find the different files and directories inside that website. We will came to know about the phpbash file from where we will be getting code execution. After getting the ever shell we will <a href=\"https:\/\/www.peerlyst.com\/tags\/enumerate\">enumerate<\/a> more and will be able to find the way to escalate the privileges and became root. This time I have made two video[s] the first one will be on getting our first <a href=\"https:\/\/www.peerlyst.com\/tags\/reverse-shell\">reverse shell<\/a> on the box and the second one will be on how we will be able to escalate the privileges. Hope you guys will enjoy it. In last but not the least I have uploaded some file[s] from which you will be able to learn about <a href=\"https:\/\/www.peerlyst.com\/tags\/bash\">bash<\/a> <a href=\"https:\/\/www.peerlyst.com\/tags\/scripting\">scripting<\/a>, <a href=\"https:\/\/www.peerlyst.com\/tags\/python\">python<\/a> and you will learn about the cronjob working.<\/p>\n<p>TenTen BOX WALKTHROUGH<\/p>\n<h3>About this machine<\/h3>\n<ol>\n<li>Machine Name: Bashed<\/li>\n<li>Machine Architecture : <a href=\"https:\/\/www.peerlyst.com\/tags\/linux\">Linux<\/a><\/li>\n<li>Machine creator: Arrexel<\/li>\n<li><a href=\"https:\/\/www.peerlyst.com\/tags\/ip-address\">IP address<\/a>: 10.10.10.68<\/li>\n<li><a href=\"https:\/\/www.peerlyst.com\/tags\/user\">User<\/a> owned: 6334<\/li>\n<li>User rooted: 4218<\/li>\n<li>Points: 20<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_279\/v1543251300\/post-attachments\/vZxmC_MOYw2jePXPmIdsUBlytkyVGhtyMvBt5Cqf6Ifdm0m9DcC3d6tW-0bgbfpu4Yt-PqArRYscBTnORp8p_EDsaQQXOXuspyxk5JnK2TPD-GazzY5RwJ4qYohVr-2iOjzVCpuB_ree710\" alt=\"\" \/><\/p>\n<h3>Pre-requestie[s]<\/h3>\n<ol>\n<li>As always you must have the <a href=\"https:\/\/www.peerlyst.com\/tags\/hackers\">hackers<\/a> mindset to approach different <a href=\"https:\/\/www.peerlyst.com\/tags\/vulnerabilities\">vulnerabilities<\/a>,<\/li>\n<li>This time you need some little bit <a href=\"https:\/\/www.peerlyst.com\/tags\/knowledge\">knowledge<\/a> about bash and python.<\/li>\n<li>You must know <a href=\"https:\/\/www.peerlyst.com\/tags\/how-to\">how to<\/a> use dirbuster or any other <a href=\"https:\/\/www.peerlyst.com\/tags\/tool\">tool<\/a> for finding different folders and file.<\/li>\n<li>You must know how to use <a href=\"https:\/\/www.peerlyst.com\/tags\/nmap\">NMAP<\/a> for <a href=\"https:\/\/www.peerlyst.com\/tags\/scanning\">scanning<\/a> port\u2019s.<\/li>\n<li>If you know bash then it will be plus point.<\/li>\n<li>Different approaches<\/li>\n<li>Try Harder mind set<\/li>\n<\/ol>\n<p>[Disclaimer : That\u2019s all you need, Now let\u2019s try to <a href=\"https:\/\/www.peerlyst.com\/tags\/pentest\">Pentest<\/a> this machine.]<\/p>\n<p>Enumeration Part<\/p>\n<h4>-Nmap Scan<\/h4>\n<p>So, first we need to <a href=\"https:\/\/www.peerlyst.com\/tags\/scan\">scan<\/a> for the open ports. Let\u2019s do it.<\/p>\n<p>We will use nmap\u2019s 3 option\u2019s \u201ci.e -sS , -sV and -sC\u201d. You must be wondering what are these. Actually these are nothing they are just a scanning options. I really want you all to read the man page of nmap from there you can understand what are these options used for. Let me just point them out simply.<\/p>\n<ol>\n<li>-sS: For scanning <a href=\"https:\/\/www.peerlyst.com\/tags\/tcp\">TCP<\/a> SYN. You need to the <a href=\"https:\/\/www.peerlyst.com\/tags\/root-privilege\">root privilege<\/a> also to use option, I believe.<\/li>\n<li>-sV: For scan for open <a href=\"https:\/\/www.peerlyst.com\/tags\/ports\">ports<\/a> to determine there <a href=\"https:\/\/www.peerlyst.com\/tags\/services\">services<\/a> and version informations.<\/li>\n<li>-sC: It is used for using the default nse nmap script. To know what are <a href=\"https:\/\/www.peerlyst.com\/tags\/nse\">NSE<\/a> <a href=\"https:\/\/www.peerlyst.com\/tags\/script\">script<\/a> read this article. [<a href=\"https:\/\/nmap.org\/book\/nse.html\" target=\"_blank\" rel=\"noopener\">Chapter 9. Nmap Scripting Engine<\/a>] Just read about it and you will understand.<\/li>\n<li>-Pn: This option will treat all hosts as online, no matter what. This is a good practice to use it to bypass filtration something.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251300\/post-attachments\/LnCP8shcTk4iyjQ-eyuHJpmoPb0h6_orHMwjnXkBDyHiPV4IjCqCZEKvwLz06izGaCj5sgryS720ECIo42vvvqQirKftFUM11MOPL3VNF2qSMmSKbj1tYwo-djLl1BW-LKwgKGI5_lvsqut\" alt=\"\" \/><\/p>\n<p><a href=\"https:\/\/shareasale.com\/r.cfm?b=1243539&amp;u=1803184&amp;m=59485&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">Hyperledger Fabric Fundamentals (LFD271)$299<\/a><\/p>\n<p>The scan is completed as you can see in the above screenshot. So as you all can see only the port 80 is open.<\/p>\n<h4>-Understanding Nmap output<\/h4>\n<p>So we have only two open port[s] now let\u2019s try to understand the output.<\/p>\n<p>#1<\/p>\n<p>Port: 80<\/p>\n<p>State:Open<\/p>\n<p>Service: http<\/p>\n<p>Version: <a href=\"https:\/\/www.peerlyst.com\/tags\/apache\">Apache<\/a> httpd 2.4.18<\/p>\n<p>Let[s] check what it is really looking like.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251302\/post-attachments\/o_7rJktqcYFiaKkVlcIvSdB24daMOOZUMoznZ7IF3leouuI0a8HvKsgzFYUCNWYbgofFly3_IDvEy1zDECFSk0Uh82FbnhgTsSs28KoIR3ti9BsHvfOROzjSDYcOliUI7ZfnxUd9_cc9kfz\" alt=\"\" \/><\/p>\n<p>It seems like it[s] working perfectly. Anyways let[s] start enumerating the box.<\/p>\n<p><a href=\"https:\/\/shareasale.com\/r.cfm?b=1193744&amp;u=1803184&amp;m=59485&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">$299 WILL ENROLL YOU IN OUR SELF PACED COURSE \u2013 LFS205 \u2013 ADMINISTERING LINUX ON AZURE!<\/a><\/p>\n<h4>Low Level Exploitation<\/h4>\n<p>The very first thing that I always used do is to check the source page and the robots.txt file.<\/p>\n<p>So here it is ,<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_508\/v1543251303\/post-attachments\/_q-2udGPMllH-hEztMUouTMV_fGI2G4NSpTuK38IcYysqRJHYth1rHTCMloL5xufAJQl4MuPTYWKLEWi-tGQtwG_sSBR88S1I6Ok4K9II0mOvBtpYTpnaTj67jiWMa_6EBdvKIRH_nin2hg\" alt=\"\" \/><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_619\/v1543251305\/post-attachments\/Vib8GqWMVUwmM6YDYMAPEM8rXdnw41abFoZE9ObjiZ3-bwWgFJAyG4aOsNBvkIPrT-km5h0EtF_49FueNyaISmWVWTzad7bpHPkNBHUj8qvjV_Lijbqm2MHVkPT_Shq1bm1bmoGW_dq49tq\" alt=\"\" \/><\/p>\n<p>I don\u2019t know if you are able to see it or not but there is nothing interesting here.<\/p>\n<p>So, let[s] start our favorite dirbuster for finding the directory. If you don\u2019t know what it is then let me tell you.<\/p>\n<p>Dirbuster:- It is a java <a href=\"https:\/\/www.peerlyst.com\/tags\/tool\">tool<\/a> that is designed to <a href=\"https:\/\/www.peerlyst.com\/tags\/brute-force\">brute force<\/a> the directory and the webpages in the website[s]. It is <a href=\"https:\/\/www.peerlyst.com\/tags\/owasp\">OWASP<\/a> <a href=\"https:\/\/www.peerlyst.com\/tags\/project\">Project<\/a>you can read more about it \u201c<a href=\"https:\/\/www.owasp.org\/index.php\/Category:OWASP_DirBuster_Project\" target=\"_blank\" rel=\"noopener\">Here<\/a>\u201d. Let[s] start it:-<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251307\/post-attachments\/V6sd_QlfmfZoaDnt0bQw2W0Yyj5NL8HMkRiFyFZINCM3ErzlzRmnoxAQMhw0aaguvghnmUYvgEbKp5tkFJaAtdNPA_O0eat2DHqn2GTlrWHJWTTd8Io3aH9pEZ7MtYdZFZo7pPHg_qdydl2\" alt=\"\" \/><\/p>\n<p>In target URL option you need to define the address of the website here in our case it is 10.10.10.48, in Number of threads I have increased it to 54 to speed up the <a href=\"https:\/\/www.peerlyst.com\/tags\/process\">process<\/a> and under wordlist option you need to specify the directory list. I used the one that the dirbuster come[s] with medium one. Give the file extension according to your need, the php is just fine for me here. Let\u2019s start our DirBuster.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251310\/post-attachments\/EE4Y_HR9abj1xwlO8_CAHJ-nHgS8GprPDYvRg1__On1X303-OtiCKOGSOgOP07TTZ6A9OhsBJLEmXBko5rw00G_saQPfhfuIOOU84dh3LONdLAfyGlrnzCBvY4_YMPvecwtAq6P5_r8xiao\" alt=\"\" \/><\/p>\n<p>So as you can see we got too many folder[s] and some php files. So, I have just export the result in text file. Here it is:<\/p>\n<p>DirBuster 1.0-RC1 \u2013 Report<\/p>\n<p><a href=\"http:\/\/www.owasp.org\/index.php\/Category:OWASP_DirBuster_Project\" target=\"_blank\" rel=\"noopener\">http:\/\/www.owasp.org\/index.php\/Category:OWASP_DirBuster_Project<\/a>Report produced on Mon Apr 30 02:48:56 EDT 2018<\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<\/p>\n<p><a href=\"http:\/\/10.10.10.68\/\" target=\"_blank\" rel=\"noopener\">http:\/\/10.10.10.68:80<\/a>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<\/p>\n<p>Directories found during <a href=\"https:\/\/www.peerlyst.com\/tags\/testing\">testing<\/a>:<br \/>\nDirs found with a 200 response:<\/p>\n<p>\/images\/<br \/>\n\/uploads\/<br \/>\n\/js\/<br \/>\n\/php\/<br \/>\n\/demo-images\/<br \/>\n\/css\/<br \/>\n\/dev\/<br \/>\nDirs found with a 403 response:<br \/>\n\/icons\/<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<br \/>\nFiles found during testing:<br \/>\nFiles found with a 200 responce:<br \/>\n\/index.html<br \/>\n\/single.html<br \/>\n\/js\/jquery.js<br \/>\n\/js\/imagesloaded.pkgd.js<br \/>\n\/js\/jquery.nicescroll.min.js<br \/>\n\/js\/jquery.smartmenus.min.js<br \/>\n\/js\/custom_google_map_style.js<br \/>\n\/js\/html5.js<br \/>\n\/php\/sendMail.php<br \/>\n\/js\/jquery.mousewheel.min.js<br \/>\n\/js\/jquery.carouFredSel-6.0.0-packed.js<br \/>\n\/js\/jquery.easing.1.3.js<br \/>\n\/js\/jquery.touchSwipe.min.js<br \/>\n\/js\/main.js<br \/>\n\/css\/carouFredSel.css<br \/>\n\/css\/clear.css<br \/>\n\/css\/common.css<br \/>\n\/css\/font-awesome.min.css<br \/>\n\/css\/sm-clean.css<br \/>\n\/dev\/phpbash.min.php<br \/>\n\/dev\/phpbash.php<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2013<\/p>\n<p><a href=\"https:\/\/shareasale.com\/r.cfm?b=1193747&amp;u=1803184&amp;m=59485&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">REGISTER TODAY FOR YOUR KUBERNETES FOR DEVELOPERS (LFD259) COURSE AND CKAD CERTIFICATION TODAY! $499!<\/a><\/p>\n<p>Let[s] check that php directory.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_486\/v1543251311\/post-attachments\/IzKmnPZK8LGMMThh64XDEpgksoNARvQ7Mo1DlEU2xMrQmmlM3LdkchKjkHbH9JTzLFT6q5nIFu1QuaPBvkuTRSHYvWNoCx0VE2H_CBvMshWySHZTQsjUpwRf6sukuM3hHG8CKM5G_cxkxov\" alt=\"\" \/><\/p>\n<p>Their is one \u201csendMail.php\u201d php file. Let[s] check \/dev directory now.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_518\/v1543251312\/post-attachments\/ieQeoEZSi9FI5jTd32uijuXkjvU6_wzoWLrKxLPmY245ebD0eEozfnplGgLDrdfaczMhGpEgEiMOZRQSgHD92adO6_7NlOP68Pr9rQ6NtQQWf_YrkZQDK662NzOtO46a4UIfKj4G_pc09i0\" alt=\"\" \/><\/p>\n<p>Okay so here are also some directory. Let[s] try to open phpbash.php<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251313\/post-attachments\/oPI1O_CsPghAqRmZD_Jx8huGpIf5C0eJpkP_hkVho7Ma6vQoiI1tSdtjMM6As49zTiPzDCEqsVU1kQoOdTgxmN7mB7KBy-AF9V7OmSqCaOlHr-8ul89gIV5wgIff6toYOsWeRRo8_zvgpcd\" alt=\"\" \/><\/p>\n<p>Okay so it is looking like a terminal using bash. So, now we can execute the commands.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251314\/post-attachments\/ojTzHAUuzqK-xNfOlUyzADFirwoapCySQWEIRBcmQi8pXFaxTmdBmAluNcqY215leEpa0YxW4IlDzYUNHJYQX3USWAr0B0oLU6jCVmd7fSzmR06js0TW9WgrKqCrPnk2he2pX806_qrtd4e\" alt=\"\" \/><\/p>\n<p>Amazing let[s] try to get the reverse shell on this box.<\/p>\n<p>Now we finally got our first low fruit reverse shell on this machine.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_360\/v1543251314\/post-attachments\/BqsAAtR4pb8kPZSc4KNzfyl7WI8fL-_XjJbFEYEZjLxxRP7k1Dv17C2qP8OdJpXn6nGljyNwWT9Xv02KGE55JsKm7KT7F4YKM1Yc9LJwtbo9OiPMkHZ3P_2eMYDcH89KGEPgM9OU_z8kbg0\" alt=\"\" \/><\/p>\n<p>SO, finally we got our low fruit privilege on this box.<\/p>\n<p><a href=\"https:\/\/shareasale.com\/r.cfm?b=1193750&amp;u=1803184&amp;m=59485&amp;urllink=&amp;afftrack=\" target=\"_blank\" rel=\"noopener\">$299 REGISTERS YOU FOR OUR NEWEST SELF PACED COURSE! LFD201 \u2013 INTRODUCTION TO OPEN SOURCE DEVELOPMENT, GIT, AND LINUX!<\/a><\/p>\n<h4>Privilege Escalation<\/h4>\n<p>So now we need to escalate the privileges to become \u201croot\u201d. In this box I will be going to show you three different methods of <a href=\"https:\/\/www.peerlyst.com\/tags\/privilege-escalation\">privilege escalation<\/a> on this machine.<\/p>\n<p>First let\u2019s start our enumeration manually first then we will upload some <a href=\"https:\/\/www.peerlyst.com\/tags\/scripts\">scripts<\/a> to check other stuffs. Let\u2019s start with checking <a href=\"https:\/\/www.peerlyst.com\/tags\/distribution\">Distribution<\/a> type by command \u201c <em>cat \/etc\/issue<\/em> \u201c<\/p>\n<p>www-data@bashed:\/home\/arrexel$ cat \/etc\/issue <a href=\"https:\/\/www.peerlyst.com\/tags\/ubuntu\">Ubuntu<\/a> 16.04.2 LTS n l<\/p>\n<p>Okay so this is Ubuntu box running version Ubuntu 9.10, Great. Now let\u2019s check what files have <a href=\"https:\/\/www.peerlyst.com\/tags\/root-1\">root<\/a> privileges which we can probably read, write and execute by the command.<\/p>\n<p>www-data@bashed:\/home\/arrexel$ find \/ -perm -222 -type d 2&gt;\/dev\/null<br \/>\n\/var\/www\/html\/uploads<br \/>\n\/var\/tmp<br \/>\n\/var\/lib\/php\/sessions<br \/>\n\/run\/lock<br \/>\n\/tmp<br \/>\n\/tmp\/.Test-unix<br \/>\n\/tmp\/.font-unix<br \/>\n\/tmp\/.XIM-unix<br \/>\n\/tmp\/VMwareDnD<br \/>\n\/tmp\/.ICE-unix<br \/>\n\/tmp\/.X11-unix<br \/>\n\/dev\/mqueue<br \/>\n\/dev\/shm<br \/>\nwww-data@bashed:\/home\/arrexel$ find \/ -perm -4000 2&gt;\/dev\/null<br \/>\n\/bin\/mount<br \/>\n\/bin\/fusermount<br \/>\n\/bin\/su<br \/>\n\/bin\/umount<br \/>\n\/bin\/ping6<br \/>\n\/bin\/ntfs-3g<br \/>\n\/bin\/ping<br \/>\n\/usr\/bin\/chsh<br \/>\n\/usr\/bin\/newgrp<br \/>\n\/usr\/bin\/sudo<br \/>\n\/usr\/bin\/chfn<br \/>\n\/usr\/bin\/passwd<br \/>\n\/usr\/bin\/gpasswd<br \/>\n\/usr\/bin\/vmware-user-suid-wrapper<br \/>\n\/usr\/lib\/dbus-1.0\/dbus-daemon-launch-helper<br \/>\n\/usr\/lib\/eject\/dmcrypt-get-device<br \/>\n\/usr\/lib\/openssh\/ssh-keysign<\/p>\n<p>Nothing seems interesting here. So now let[s] try \u201csudo -l\u201d to list the allowed (and forbidden) commands for the invoking user (or the user specified by the -U option) on the current host. A longer list format is used if this option is specified multiple times and the <a href=\"https:\/\/www.peerlyst.com\/tags\/security-policy\">security policy<\/a> supports a verbose output format.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_624\/v1543251315\/post-attachments\/HYYytOfAfe9He5TQhh3df2OknyI1uHiQbhmqhtSYqxLY_AVHgM6dybr6FZXv0Vx9fcmJB2RSZ48JBCxnefb9W70pEw-Tovy-35uTkEhF4tyi4txNuIT8eRybNrjdAB2_yuefKZBK_b8p6tv\" alt=\"\" \/><\/p>\n<p>So, we can <a href=\"https:\/\/www.peerlyst.com\/tags\/sudo\">sudo<\/a> to scriptmanager user without any password. Let[s] do it.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_596\/v1543251315\/post-attachments\/qULMe86kmGLCypdZnb_eN6Sg4pIw6YPQMws20F6Y75BYGOzzWjrpDvI4N1o8suefsanmsIkSAivGzPYkrNaqYxxViD6xMo5UBqjzWSMNduX62E1bLTStqY8A7_jsftxheYEPV1l8_t8asbs\" alt=\"\" \/><\/p>\n<p>Amazing now we are no longer www-data , Let[s] start our enumeration from the root directory now \u201c \/ \u201c<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_522\/v1543251316\/post-attachments\/jCoOwtOjK1xIQHXVCrfLg0BwE-bBLAcSfp_92o-HZ0fihqN498KZkHn-Jc50RYUssefFCnXjlK49kme8QDJM9n7HFNDJW7bawhuGZ65F2FrpAP0YPCafz04GDpi76gki0f05Ft6D_yzgx29\" alt=\"\" \/><\/p>\n<p>If you are having Linux as your primary <a href=\"https:\/\/www.peerlyst.com\/tags\/operating-system\">operating system<\/a> then you will notice \u201c\/scripts\u201d directory is something suspicious. Which do not come with Linux by default. SO, lets check what are the files and directories inside that folder.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_552\/v1543251317\/post-attachments\/3nmOCJOugg94fpLx38jtDvLnICzUJMBvEZROeMt0iLyCYhjln0x14fJuxmiDZ5SImND9QyACihdAyAiJxFPm0TJ3eNykMlw_cqb-gMiMKT40eTBtuOIkjQAPMHE0JqWXtHcJskaL_eomo0f\" alt=\"\" \/><\/p>\n<p>We are having two files : test.py and test.txt . Let[s] check what is written in test.py<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_349\/v1543251317\/post-attachments\/71Wfbl8OBWZ0h8Oxngky-ItAftWeIoG5ZHNN-1unY3Tywp_IgLmK_Q4waGm4APwsm2s3JiWKNIB4-wpvhtH9KuRK_8O37kHcDulG_KoETv447EGgbDJ-Lsbi3NpSols1ml9HG822_atb4w4\" alt=\"\" \/><\/p>\n<p>Okay so it is a simple <a href=\"https:\/\/www.peerlyst.com\/tags\/python-script\">python script<\/a> which is opening the file test.txt in <a href=\"https:\/\/www.peerlyst.com\/tags\/writing\">writing<\/a> mode and writing \u201ctesting 123!\u201d inside that test.txt file. After writing it is closing that file. If you will see the above <a href=\"https:\/\/www.peerlyst.com\/tags\/screenshot\">screenshot<\/a> again you will see test.txt was created 00:42 minute ago. Means maybe cron <a href=\"https:\/\/www.peerlyst.com\/tags\/job\">job<\/a> is running every minute.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_567\/v1543251318\/post-attachments\/4Q5R0u9fRPwKMQXYCVF8jfhR1OFWgAiNWAWew20PT_JtG0RnmJBfPNVzO-oNpoylFhGEU5Te7cvzF8JRmdR_SgbvL-B581SrZ6pUsQb2qDCb_AZ1awxpVCy2NTKGPSKlDmbuwanK_ldhy06\" alt=\"\" \/><\/p>\n<p>Here is the proof that it is running every minute. Now we know that whatever is inside test.py it will be executed as root. So, now we can re-write the test.py and enter our python reverse shell.<\/p>\n<p>Amazing we finally escalated the privileges<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/peerlyst\/image\/upload\/c_limit,dpr_auto,f_auto,fl_lossy,q_auto,w_425\/v1543251319\/post-attachments\/Ea7d8d2vzpEMwivBPnhiMkhj8RZST1vSVOFKMAlujf2MS-SYqGSzI5U5IGH65tJoaT0ikHyy0HAzfeLaI03LP9SNvJEwZTOzFpmqumgQ5-3KmoKVF30smUEY30tSgpm2Sy9hR8vK_is6c5y\" alt=\"\" \/><\/p>\n<p>.<a href=\"https:\/\/linuxsecurityblog.com\/2018\/12\/10\/pop-the-box\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let[s] talk a little about this box. In this HTB machine we will see only one port is open and that will be the http one , we will fireup the dirbuster to find the different files and directories inside that website. We will came to know about the phpbash file from where we will &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/11\/pop-the-box-ls-blog\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Pop the Box \u2013 ls \/blog&#8221;<\/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":[1],"tags":[],"class_list":["post-5376","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=5376"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5376\/revisions"}],"predecessor-version":[{"id":5378,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5376\/revisions\/5378"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=5376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=5376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=5376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}