{"id":1403,"date":"2021-06-08T09:00:37","date_gmt":"2021-06-08T06:00:37","guid":{"rendered":"https:\/\/macrosec.tech\/?p=1403"},"modified":"2021-09-02T15:32:43","modified_gmt":"2021-09-02T12:32:43","slug":"linux-privilege-escalation-techniques-using-suid","status":"publish","type":"post","link":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/","title":{"rendered":"Linux Privilege Escalation Techniques using SUID"},"content":{"rendered":"<p><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-parallax-none nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-padding-right:50px;--awb-padding-left:50px;--awb-background-color:#686868;--awb-background-image:url(&quot;https:\/\/macrosec.tech\/wp-content\/uploads\/2020\/01\/85204.jpg&quot;);--awb-background-size:cover;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last\" style=\"--awb-padding-top:0%;--awb-padding-right:0%;--awb-padding-bottom:0%;--awb-padding-left:0%;--awb-bg-size:cover;--awb-margin-top:10px;--awb-margin-bottom:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-column-wrapper-legacy\"><div class=\"fusion-column-content-centered\"><div class=\"fusion-column-content\"><div class=\"fusion-text fusion-text-1\"><h2 style=\"text-align: center;font-size: 40px\"><strong><span style=\"text-decoration: underline\">Linux Privilege Escalation Techniques via SUIDs<\/span><\/strong><\/h2>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-1 hover-type-none\"><img decoding=\"async\" width=\"400\" height=\"400\" alt=\"Haystack - Hack The Box Machine\" title=\"226772\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png\" class=\"img-responsive wp-image-1702\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772-200x200.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png 400w\" sizes=\"(max-width: 800px) 100vw, 400px\" \/><\/span><\/div><\/div><\/div><\/div><div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><\/div><div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-2 nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-padding-top:30px;--awb-padding-right:50px;--awb-padding-left:50px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-1 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last\" style=\"--awb-bg-size:cover;--awb-margin-top:10px;--awb-margin-bottom:10px;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-column-wrapper-legacy\"><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-no-large-visibility fusion-full-width-sep\" style=\"margin-left: auto;margin-right: auto;margin-top:15px;margin-bottom:15px;width:100%;\"><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-text fusion-text-2\"><p style=\"font-size: 18px\">This blog post was written by <a href=\"https:\/\/www.linkedin.com\/in\/dharmik-karania-160239b5\/\">Dharmik Karania<\/a>.<\/p>\n<\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-clearfix\" style=\"float:left;margin-top:15px;margin-bottom:15px;width:100%;max-width:35%;\"><div class=\"fusion-separator-border sep-single sep-solid\" style=\"--awb-height:20px;--awb-amount:20px;--awb-sep-color:#b51616;border-color:#b51616;border-top-width:1px;\"><\/div><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-text fusion-text-3\"><h2 style=\"font-size: 24px;color: #b51616;text-align: left\"><strong>Introduction<\/strong><\/h2>\n<h2 style=\"font-size: 24px;color: #b51616;text-align: left\"><strong>SUID Overview. What is SUID? <\/strong><\/h2>\n<p style=\"font-size: 20px\">SUID is Set User ID. This has to do with permission settings.<\/p>\n<p style=\"font-size: 20px\">If we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-2 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"863\" height=\"727\" title=\"Capture\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/Capture.png\" alt class=\"img-responsive wp-image-1620\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/Capture-200x168.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/Capture-400x337.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/Capture-600x505.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/Capture-800x674.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/Capture.png 863w\" sizes=\"(max-width: 800px) 100vw, 863px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-4\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">How does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else.<\/p>\n<p style=\"font-size: 20px\">Lets try ls -la on \/etc\/shadow which Is something that is definitely owned by root. We notice root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-3 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"861\" height=\"214\" title=\"2\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-4.png\" alt class=\"img-responsive wp-image-1621\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-4-200x50.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-4-400x99.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-4-600x149.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-4-800x199.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-4.png 861w\" sizes=\"(max-width: 800px) 100vw, 861px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-5\"><p>\u00a0<\/p>\n<p style=\"font-size: 20px\">How does this information pertain to us in SUIDs? For example if we want to make a certain file executable, we say chmod +x or something like chmod 777 . This basically means that across the board we need RWX. Why does it do that? If we look at it from the bits perspective, we notice that there are 4 bits for read, 2 bits for write, and 1 bit for execute.<\/p>\n<p style=\"font-size: 20px\">There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. Therefore, the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.<\/p>\n<p style=\"font-size: 20px\">In this blog we will be looking at hunting down the S in this location.<\/p>\n<p style=\"font-size: 20px\">NOTE: Not everything is vulnerable which has the SUID permission set. We have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.<\/p>\n<p style=\"font-size: 20px\">How do we hunt these down? There is a command we can use.<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">find \/ -perm -u=s -type f 2&gt;\/dev\/null<\/p>\n<p style=\"font-size: 20px\">The forward slash means that we will start from the top or the root of the file system.<\/p>\n<p style=\"font-size: 20px\">-perm for permission<\/p>\n<p style=\"font-size: 20px\">Then we state what permissions we are looking for: We want all files owned by the root user and we are looking for that &#8220;s&#8221;.<\/p>\n<p style=\"font-size: 20px\">Then we say what type we are looking for, so we say files (f).<\/p>\n<p style=\"font-size: 20px\">And we throw this into the dev null which means that it will filter out the errors so that they will not be output to your console.<\/p>\n<p style=\"font-size: 20px\">2 represents the error descriptor, which is where errors are written to. By default they are printed out on the console.<\/p>\n<p style=\"font-size: 20px\">\\&gt; redirects output to the specified place, in this case \/dev\/null<\/p>\n<p style=\"font-size: 20px\">Note: \/dev\/null is the standard Linux device where you send output that you want ignored.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-4 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1092\" height=\"177\" title=\"3\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-4.png\" alt class=\"img-responsive wp-image-1626\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-4-200x32.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-4-400x65.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-4-600x97.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-4-800x130.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-4.png 1092w\" sizes=\"(max-width: 800px) 100vw, 1092px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-6\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">In this blog, we will be looking at 4 methods of escalating privileges using SUIDs:<\/p>\n<ol style=\"font-size: 20px\">\n<li>Privilege Escalation via SUID.<\/li>\n<li>Escalation via Shared Object Injection.<\/li>\n<li>Escalation via Binary Symlinks.<\/li>\n<li>Escalation via Environmental Variables.<\/li>\n<\/ol>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>Privilege escalation via SUID<\/strong><\/h3>\n<p style=\"font-size: 20px\">In order to demonstrate this, there is a box on TryHackMe called Vulnversity which i shall use to demonstrate.<\/p>\n<p style=\"font-size: 20px\">Once we have an initial foothold on the machine, we need to perform privilege escalation in order to obtain the root flag.<\/p>\n<p style=\"font-size: 20px\">I have got initial foothold onto the machine and now I will show how we can hunt the SUID from here and get root.<\/p>\n<p style=\"font-size: 20px\">First, I will run the find command:<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-5 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"788\" height=\"735\" title=\"4\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-4.png\" alt class=\"img-responsive wp-image-1628\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-4-200x187.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-4-400x373.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-4-600x560.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-4.png 788w\" sizes=\"(max-width: 800px) 100vw, 788px\" \/><\/span><\/div><\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-6 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"787\" height=\"349\" title=\"5\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-5.png\" alt class=\"img-responsive wp-image-1630\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-5-200x89.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-5-400x177.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-5-600x266.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-5.png 787w\" sizes=\"(max-width: 800px) 100vw, 787px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-7\"><p>&nbsp;<\/p>\n<\/div><div class=\"fusion-text fusion-text-8\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">This command lists all the files which has SUID permissions. We can now look at an online repository called GTFOBins to find out which one will stand out. We need to compare the list we retrieved with the the GTFOBins repository. If we scroll on GTFOBins, we see that we have systemctl.<\/p>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/gtfobins.github.io\/#+suid\">https:\/\/gtfobins.github.io\/#+suid<\/a><\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-7 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"785\" height=\"484\" title=\"7\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-4.png\" alt class=\"img-responsive wp-image-1632\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-4-200x123.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-4-400x247.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-4-600x370.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-4.png 785w\" sizes=\"(max-width: 800px) 100vw, 785px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-9\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">When we click on it, We read that \u201cit runs with the SUID bit set and may be exploited to access the file system, escalate or maintain access with elevated privileges and works as a SUID backdoor.\u201d. This basically means that we can use this code to elevate privileges. Lets us do that !!<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-8 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"949\" height=\"644\" title=\"8\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-5.png\" alt class=\"img-responsive wp-image-1633\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-5-200x136.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-5-400x271.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-5-600x407.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-5-800x543.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-5.png 949w\" sizes=\"(max-width: 800px) 100vw, 949px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-10\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">The code we will use is shown below <\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-9 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"638\" height=\"275\" title=\"9\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-5.png\" alt class=\"img-responsive wp-image-1634\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-5-200x86.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-5-400x172.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-5-600x259.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-5.png 638w\" sizes=\"(max-width: 800px) 100vw, 638px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-11\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">I have modified the code a little so as to retrieve the root flag. The modified code is explained below.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-10 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1021\" height=\"301\" title=\"10\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-3.png\" alt class=\"img-responsive wp-image-1637\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-3-200x59.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-3-400x118.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-3-600x177.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-3-800x236.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-3.png 1021w\" sizes=\"(max-width: 800px) 100vw, 1021px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-12\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We run each of these commands in the initial foothold terminal. The code is explained below:<\/p>\n<p style=\"font-size: 20px\">We first create an environmental variable and we call it TF and we are making a service (a systemctl service) that is what the dot service does. The MKtemp is what we use to create a temporary file on the system as a service. <\/p>\n<p style=\"font-size: 20px\">Then the next line is to just echo the service<\/p>\n<p style=\"font-size: 20px\">When the service starts, we call out bin\/sh and we execute a command with bin\/sh and the command we run is \/root\/root.txt &gt; \/tmp\/output to grab the root flag and we will put to the tmp file.<\/p>\n<p style=\"font-size: 20px\">Lastly we will install and what we are going to do is that we will run the \u201cwantedBy\u201d at the run level of the multi user dot target and it will be put into the environmental variable $TF<\/p>\n<p style=\"font-size: 20px\">We then use the link command thus making the file available to run via system ctl<\/p>\n<p style=\"font-size: 20px\">And the last line enables the environmental variable.<\/p>\n<p style=\"font-size: 20px\">In theory if we cat \/tmp\/output, we should be able to retrieve the root flag. <\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-11 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1030\" height=\"384\" title=\"11\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-4.png\" alt class=\"img-responsive wp-image-1636\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-4-200x75.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-4-400x149.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-4-600x224.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-4-800x298.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-4.png 1030w\" sizes=\"(max-width: 800px) 100vw, 1030px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-13\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">Boom! Yes we escalated privileges and retrieved the root flag.<\/p>\n<p style=\"font-size: 20px\">From start to finish we took advantage of the SUID bit being set. As a normal www-data user, we were able to execute something special as somebody being more privileged than us.<\/p>\n<p style=\"font-size: 20px\">This lab did not require us to get access to the root domain but required us to escalate our privileges and get the root flag and that is why as \u201cwww-data\u201d user, we retrieved the root flag without being the root domain user.<\/p>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\">Privilege escalation via Shared Object Injection<\/h3>\n<p style=\"font-size: 20px\">In order to demonstrate this, I will be using a lab environment specifically created to demonstrate Linux Privilege Escalation techniques by TCM Security (Heath Adams).<\/p>\n<p style=\"font-size: 20px\">I have SSH into the lab and the first command I type is the find command as follows:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">find \/ -type f -perm -04000 -ls 2&gt;\/dev\/null<\/p>\n<p style=\"font-size: 20px\">This is the same command as the one previously seen but provides more detailed information. The -04000 means to list set-user-ID files and directories<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-12 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1019\" height=\"436\" title=\"12\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-4.png\" alt class=\"img-responsive wp-image-1638\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-4-200x86.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-4-400x171.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-4-600x257.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-4-800x342.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-4.png 1019w\" sizes=\"(max-width: 800px) 100vw, 1019px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-14\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">The first thing is to go over each line by line. We compare the list retrieved with that in GTFOBins and identify what stands out and what else can we potentially do with this?<\/p>\n<p style=\"font-size: 20px\">One thing we can do is SO Injection. SO Injection means we can inject a malicious piece of code which will elevate our shell to root. We thus need to identify where we can insert the malicious code. This machine has been created with this vulnerability so we can see how we can use Shared object injection to escalate privileges.<\/p>\n<p style=\"font-size: 20px\">We have been using the find command to identify possible attack paths. Another way of getting this information is to upload Linpeas to the machine and this vulnerability as highlighted in the image above will be displayed.<\/p>\n<p style=\"font-size: 20px\">What we can do next Is to run this suid-so binary and see what happens. The image below shows what happens when we run it<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-13 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1023\" height=\"152\" title=\"13\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-5.png\" alt class=\"img-responsive wp-image-1639\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-5-200x30.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-5-400x59.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-5-600x89.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-5-800x119.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-5.png 1023w\" sizes=\"(max-width: 800px) 100vw, 1023px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-15\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">It just says calculating something please wait. We do not know what is happening, but we can utilize a tool called Strace to see what is happening behind the scenes. <\/p>\n<p style=\"font-size: 20px\">Strace is a diagnostic debugging and instructional user space utility for linux. It is used to monitor and tamper with interactions between processes and the linux kernel. We will basically trace what is happening when this suid-so runs.<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">strace \/usr\/local\/bin\/suid-so 2&gt;&amp;1 <\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-14 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1016\" height=\"574\" title=\"14\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-4.png\" alt class=\"img-responsive wp-image-1640\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-4-200x113.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-4-400x226.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-4-600x339.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-4-800x452.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-4.png 1016w\" sizes=\"(max-width: 800px) 100vw, 1016px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-16\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We are getting a bunch of these where it mentions no such file or directory. That is exactly what we want to hunt down. We want to try see what it is trying to access and the fact the file or directory is not found, what can we do, or how can we inject a malicious file ?<\/p>\n<p style=\"font-size: 20px\">We can make the results a little cleaner and see how we can hunt this down using the command:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">strace \/usr\/local\/bin\/suid-so 2&gt;&amp;1 | grep -i -E \u201copen|access|no such file\u201d<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-15 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1020\" height=\"573\" title=\"15\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-4.png\" alt class=\"img-responsive wp-image-1641\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-4-200x112.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-4-400x225.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-4-600x337.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-4-800x449.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-4.png 1020w\" sizes=\"(max-width: 800px) 100vw, 1020px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-17\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We get no such file or directory for a bunch of them. However there is this particular one which I have highlighted which stands out because it is looking for some kind of configuration. <\/p>\n<p style=\"font-size: 20px\">What we want to do is that we want to overwrite \/home\/user\/.config\/libcalc.so.<\/p>\n<p style=\"font-size: 20px\">Lets try ls -la on \/home\/user\/.config\/libcalc.so<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-16 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1014\" height=\"52\" title=\"16\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-4.png\" alt class=\"img-responsive wp-image-1642\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-4-200x10.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-4-400x21.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-4-600x31.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-4-800x41.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-4.png 1014w\" sizes=\"(max-width: 800px) 100vw, 1014px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-18\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We see that it returns a message saying that \u201cNo such file or directory.\u201d<\/p>\n<p style=\"font-size: 20px\">I then try to look at the permissions of the .config folder<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-17 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1015\" height=\"57\" title=\"17\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-4.png\" alt class=\"img-responsive wp-image-1643\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-4-200x11.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-4-400x22.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-4-600x34.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-4-800x45.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-4.png 1015w\" sizes=\"(max-width: 800px) 100vw, 1015px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-19\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">Again, the same message. Finally I look at the permissions of the user directory.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-18 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"887\" height=\"425\" title=\"18\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-4.png\" alt class=\"img-responsive wp-image-1645\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-4-200x96.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-4-400x192.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-4-600x287.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-4-800x383.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-4.png 887w\" sizes=\"(max-width: 800px) 100vw, 887px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-20\"><p>\u00a0<\/p>\n<p style=\"font-size: 20px\">We have access to \/home\/user because that is our folder.<\/p>\n<p style=\"font-size: 20px\">What we will do is that we will try to overwrite libcalc.so and we will put something malicious so that when we run the binary, it will go through this command (\/usr\/local\/bin\/suid-so), it will look for libcalc.so and it wont find it but rather than execute the malicious command and elevate our shell.<\/p>\n<p style=\"font-size: 20px\">To do this, we create a new file called libcalc.c and write the following code:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">#include<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">#include<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">static void inject() __attribute__((constructor));<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">void inject() <\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-19 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1094\" height=\"472\" title=\"19\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-4.png\" alt class=\"img-responsive wp-image-1646\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-4-200x86.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-4-400x173.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-4-600x259.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-4-800x345.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-4.png 1094w\" sizes=\"(max-width: 800px) 100vw, 1094px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-21\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">If we do ls, we do not see the .config directory so we create the directory.<\/p>\n<p style=\"font-size: 20px\">mkdir \/home\/user\/.config<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-20 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1106\" height=\"37\" title=\"20\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-4.png\" alt class=\"img-responsive wp-image-1647\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-4-200x7.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-4-400x13.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-4-600x20.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-4-800x27.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-4.png 1106w\" sizes=\"(max-width: 800px) 100vw, 1106px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-22\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We then need to compile the C file we created using the command shown below and place the compiled file in \/home\/user\/.config\/libcalc.so file path and we achieve this using the -O switch. <\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">gcc -shared -fPIC -o \/home\/user\/.config\/libcalc.so \/home\/user\/libcalc.c<\/p>\n<p style=\"font-size: 20px\">fPIC is Position Independent Code means that the generated machine code is not dependent on being located at a specific address in order to work.<\/p>\n<p style=\"font-size: 20px\">Once we compile, we run \/usr\/local\/bin\/suid-so and we get root<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-21 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1091\" height=\"357\" title=\"45\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/45-1.png\" alt class=\"img-responsive wp-image-1691\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/45-1-200x65.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/45-1-400x131.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/45-1-600x196.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/45-1-800x262.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/45-1.png 1091w\" sizes=\"(max-width: 800px) 100vw, 1091px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-23\"><p>&nbsp;<\/p>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>Privilege escalation via Binary Symlinks.<\/strong><\/h3>\n<p style=\"font-size: 20px\">This is part of vulnerability with nginx and utilizing suid to escalate to root.<\/p>\n<p style=\"font-size: 20px\">Nginx is a http and reverse proxy server. The issue in the vulnerability here has to deal with the permission of the logs that are being created by nginx. Because of how the permissions are set, malicious attackers can utilize those to escalate their privileges from a www-data user to root.<\/p>\n<p style=\"font-size: 20px\">When we compromise a web user and get initial foothold, we get access to www-data, so if we have a situation like that and if it meets the criteria then we can compromise this server.<\/p>\n<p style=\"font-size: 20px\">This environment has again been simulated by the lab created by Heath Adams.<\/p>\n<p style=\"font-size: 20px\">In order to demonstrate this, I will first switch user to root and login as www-data.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-22 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"770\" height=\"381\" title=\"22\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-4.png\" alt class=\"img-responsive wp-image-1649\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-4-200x99.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-4-400x198.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-4-600x297.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-4.png 770w\" sizes=\"(max-width: 800px) 100vw, 770px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-24\"><p>\u00a0<\/p>\n<p style=\"font-size: 20px\">We can use the linux-exploit-suggester.sh script to enumerate on the exploits we can utilize to escalate to root. This script is found in the tools directory<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-23 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1087\" height=\"682\" title=\"23\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-4.png\" alt class=\"img-responsive wp-image-1650\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-4-200x125.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-4-400x251.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-4-600x376.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-4-800x502.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-4.png 1087w\" sizes=\"(max-width: 800px) 100vw, 1087px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-25\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">The results when the script is run is shown below:<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-24 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1094\" height=\"618\" title=\"24\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-4.png\" alt class=\"img-responsive wp-image-1651\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-4-200x113.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-4-400x226.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-4-600x339.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-4-800x452.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-4.png 1094w\" sizes=\"(max-width: 800px) 100vw, 1094px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-26\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">One of the results suggested was nginxed-root.sh as highlighted above. The scan tells us that there is escalation ability to root through nginx<\/p>\n<p style=\"font-size: 20px\">We can also identify this manually by doing:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">dpkg -l | grep nginx<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-25 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1093\" height=\"171\" title=\"25\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-4.png\" alt class=\"img-responsive wp-image-1652\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-4-200x31.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-4-400x63.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-4-600x94.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-4-800x125.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-4.png 1093w\" sizes=\"(max-width: 800px) 100vw, 1093px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-27\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">What are we exactly looking for? We are looking for older versions of nginx. Anything newer than 1.6.2 will be patched. In this case 1.6.2 is not patched. We have identified the vulnerability and therefore the first condition is met. We also need to use the find command to see where the SUID will come into play in order to meet the second condition. I run the find command as shown below:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">find \/ -type f -perm -04000 -ls 2&gt;\/dev\/null<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-26 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1100\" height=\"429\" title=\"26\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-2.png\" alt class=\"img-responsive wp-image-1653\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-2-200x78.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-2-400x156.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-2-600x234.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-2-800x312.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-2.png 1100w\" sizes=\"(max-width: 800px) 100vw, 1100px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-28\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">This method takes advantage of the SUID bit being Set on \/usr\/bin\/sudo. Therefore, \/usr\/bin\/sudo is required for this to work. <\/p>\n<p style=\"font-size: 20px\">Therefore, both the conditions have been met. The first condition is that the suid bit must be set on sudo for this to work and we have the vulnerable version of nginx which is the second condition. We can now elevate our privilges<\/p>\n<p style=\"font-size: 20px\">At this point we can take a look at the permissions of the log files of nginx which sit at \/var\/log\/nginx<\/p>\n<p style=\"font-size: 20px\">The command I used is:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">ls -la \/var\/log\/nginx<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-27 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"884\" height=\"204\" title=\"27\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-2.png\" alt class=\"img-responsive wp-image-1657\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-2-200x46.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-2-400x92.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-2-600x138.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-2-800x185.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-2.png 884w\" sizes=\"(max-width: 800px) 100vw, 884px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-29\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We can see the folder has RWX so with this RWX, we can take advantage of that.<\/p>\n<p style=\"font-size: 20px\">What we can do is that we can utilize a symlink to replace the log files with a malicious file. We can run a script that will do this for us.<\/p>\n<p style=\"font-size: 20px\">A symlink is a symbolic link is a file that contains a reference to another file or directory in the form of an absolute or relative path. We create a symlink and the symlink is going to be malicious in the sense that it will tie itself to the log file and when it executes, it will execute to us with root privileges.<\/p>\n<p style=\"font-size: 20px\">The only condition here is that nginx has to startup or restart, and when that happens, the logs that will be written to the file will be pointing to the symlink, and therefore this will allow it to elevate privileges. The only issue in this lab is that we will have to restart nginx manually.<\/p>\n<p style=\"font-size: 20px\">We run nginx-root.sh and we run it and point it to the log file using the command<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">.\/nginx-root.sh \/var\/log\/nginx\/error.log<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-28 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1093\" height=\"621\" title=\"28\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-2.png\" alt class=\"img-responsive wp-image-1659\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-2-200x114.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-2-400x227.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-2-600x341.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-2-800x455.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-2.png 1093w\" sizes=\"(max-width: 800px) 100vw, 1093px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-30\"><p>&nbsp;<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-29 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1095\" height=\"613\" title=\"29\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/29-1.png\" alt class=\"img-responsive wp-image-1660\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/29-1-200x112.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/29-1-400x224.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/29-1-600x336.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/29-1-800x448.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/29-1.png 1095w\" sizes=\"(max-width: 800px) 100vw, 1095px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-31\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">It has created a symlink and it is now waiting for the for the nginx service to be restarted. <\/p>\n<p style=\"font-size: 20px\">The next time the nginx service is restarted, it should generate a root shell for us and this is taking advantage of the sudo suid as well. <\/p>\n<p style=\"font-size: 20px\">Now what we need to do is to do restart the nginx service. We need to do that manually because this is a lab environment. <\/p>\n<p style=\"font-size: 20px\">I then open a new terminal and Login as root in and to restart nginx we type:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">invoke-rc.d  nginx rotate &gt;\/dev\/null 2&gt;&amp;1<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-30 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1091\" height=\"466\" title=\"30\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/30-1.png\" alt class=\"img-responsive wp-image-1662\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/30-1-200x85.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/30-1-400x171.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/30-1-600x256.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/30-1-800x342.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/30-1.png 1091w\" sizes=\"(max-width: 800px) 100vw, 1091px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-32\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">Since we have restarted the service, it escalated the privileges and we got root as shown below.<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-31 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1093\" height=\"615\" title=\"31\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/31-2.png\" alt class=\"img-responsive wp-image-1663\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/31-2-200x113.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/31-2-400x225.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/31-2-600x338.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/31-2-800x450.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/31-2.png 1093w\" sizes=\"(max-width: 800px) 100vw, 1093px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-33\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">I used linpeas in this machine. There can be instances where the vulnerabilities are not identified by linpeas. It is also recommended to run the exploit suggester which can be found in the link below. <\/p>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/github.com\/mzet-\/linux-exploit-suggester\">https:\/\/github.com\/mzet-\/linux-exploit-suggester<\/a><\/p>\n<\/div><div class=\"fusion-text fusion-text-34\"><p>&nbsp;<\/p>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>Privilege escalation via Environment Variables.<\/strong><\/h3>\n<p style=\"font-size: 20px\">What are environmental variables? They are variables that are available system like and are inherited by all child processes and shells. Another definition is: An environment variable is a variable whose value is set outside the program, typically through functionality built into the operating system or microservice.<\/p>\n<p style=\"font-size: 20px\">I am still using the machine developed by Heath Adams to demonstrate this section.<\/p>\n<p style=\"font-size: 20px\">To list the environment variables, we can just type $env in the terminal and this will list all the environment variables as shown below:<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-32 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"416\" height=\"122\" title=\"32\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/32-1.png\" alt class=\"img-responsive wp-image-1665\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/32-1-200x59.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/32-1-400x117.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/32-1.png 416w\" sizes=\"(max-width: 800px) 100vw, 416px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-35\"><p>&nbsp;<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-33 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1090\" height=\"616\" title=\"33\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/33-1.png\" alt class=\"img-responsive wp-image-1666\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/33-1-200x113.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/33-1-400x226.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/33-1-600x339.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/33-1-800x452.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/33-1.png 1090w\" sizes=\"(max-width: 800px) 100vw, 1090px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-36\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">The environmental variables are displayed in the above screenshot. For example PATH is a very popular environmental variable as highlighted above.<\/p>\n<p style=\"font-size: 20px\">We can run the find command<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">find \/ -type f -perm -4000 -ls 2&gt;\/null\/dev<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-34 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1091\" height=\"578\" title=\"34\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/34-1.png\" alt class=\"img-responsive wp-image-1667\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/34-1-200x106.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/34-1-400x212.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/34-1-600x318.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/34-1-800x424.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/34-1.png 1091w\" sizes=\"(max-width: 800px) 100vw, 1091px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-37\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">A couple of binaries are retrieved. We have got the \/usr\/local\/bin\/id-env and \/env2 as highlighted above.<\/p>\n<p style=\"font-size: 20px\">These binaries are custom made for this lab environment only for purposes of demonstration otherwise on real machines, a lot of enumeration is needed. <\/p>\n<p style=\"font-size: 20px\">We can try running this binary and see what happens.<\/p>\n<\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-full-width-sep\" style=\"margin-left: auto;margin-right: auto;width:100%;\"><div class=\"fusion-separator-border sep-single sep-solid\" style=\"--awb-height:20px;--awb-amount:20px;border-color:#3e3e3e;border-top-width:1px;\"><\/div><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-35 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1095\" height=\"109\" title=\"35\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/35-1.png\" alt class=\"img-responsive wp-image-1668\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/35-1-200x20.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/35-1-400x40.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/35-1-600x60.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/35-1-800x80.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/35-1.png 1095w\" sizes=\"(max-width: 800px) 100vw, 1095px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-38\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">It says \u201chey am starting the apache 2 web server and it is already running\u201d<\/p>\n<p style=\"font-size: 20px\">Let us try and see what this is actually doing. We can try to run strings. Strings- primarily focuses on determining the contents of and extracting text from the binary files. The command i use is: <\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">strings \/usr\/local\/bin\/suid-env <\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-36 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1094\" height=\"617\" title=\"36\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/36-1.png\" alt class=\"img-responsive wp-image-1669\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/36-1-200x113.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/36-1-400x226.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/36-1-600x338.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/36-1-800x451.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/36-1.png 1094w\" sizes=\"(max-width: 800px) 100vw, 1094px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-39\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We notice some of this does not make sense but If we look at the bottom (Service Apache2 start), that makes sense. <\/p>\n<p style=\"font-size: 20px\">We see &#8220;service apache2 start&#8221; which basically means that it is starting the apache 2 service. It is utilizing the &#8220;Service&#8221; command. How is it doing that? <\/p>\n<p style=\"font-size: 20px\">Well it is doing that from our path. So what is our path? We can type in \u201cprint $PATH\u201d<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-37 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1094\" height=\"614\" title=\"37\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/37-1.png\" alt class=\"img-responsive wp-image-1670\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/37-1-200x112.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/37-1-400x224.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/37-1-600x337.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/37-1-800x449.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/37-1.png 1094w\" sizes=\"(max-width: 800px) 100vw, 1094px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-40\"><p>\u00a0<\/p>\n<p style=\"font-size: 20px\">We notice the path is \/usr\/local\/bin \u2026\u2026<\/p>\n<p style=\"font-size: 20px\">What is happening is that it is looking through this path and it says \"Hey! Where is service?\". This is because we are just calling the service command and it knows this because of the path. The environmental variable is set to this path and that is how we the service command is called. <\/p>\n<p style=\"font-size: 20px\">What if we change where service is called from? What if we make a malicious file called service, make it execute and make us elevate to root? To do this all we need to do is to change the environmental variable path. <\/p>\n<p style=\"font-size: 20px\">We will do a one line c command. <\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">\"echo 'int main() ' > tmp\/service.c<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-38 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1093\" height=\"59\" title=\"38\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/38-1.png\" alt class=\"img-responsive wp-image-1671\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/38-1-200x11.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/38-1-400x22.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/38-1-600x32.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/38-1-800x43.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/38-1.png 1093w\" sizes=\"(max-width: 800px) 100vw, 1093px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-41\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">Now let us compile service.c using the command:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">gcc \/tmp\/service.c -o \/tmp\/service<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-39 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1095\" height=\"138\" title=\"39\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/39-3.png\" alt class=\"img-responsive wp-image-1673\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/39-3-200x25.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/39-3-400x50.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/39-3-600x76.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/39-3-800x101.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/39-3.png 1095w\" sizes=\"(max-width: 800px) 100vw, 1095px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-42\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We now have the malicious service sitting in tmp\/<\/p>\n<p style=\"font-size: 20px\">We now need to change our path which is the environmental variable. To do this, we do:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">export PATH=\/tmp:$PATH<\/p>\n<p style=\"font-size: 20px\">If we print path again, we notice that \/tmp is called first then \/usr\/local\/bin. Therefore, it will look for tmp first for service which has the malicious code.<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">print $PATH<\/p>\n<p style=\"font-size: 20px\">This is shown in the screenshot below:<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-40 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1092\" height=\"424\" title=\"40\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/40-1.png\" alt class=\"img-responsive wp-image-1674\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/40-1-200x78.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/40-1-400x155.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/40-1-600x233.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/40-1-800x311.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/40-1.png 1092w\" sizes=\"(max-width: 800px) 100vw, 1092px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-43\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We now run \/usr\/local\/bin\/suid-env <\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-41 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1098\" height=\"455\" title=\"41\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/41-1.png\" alt class=\"img-responsive wp-image-1675\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/41-1-200x83.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/41-1-400x166.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/41-1-600x249.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/41-1-800x332.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/41-1.png 1098w\" sizes=\"(max-width: 800px) 100vw, 1098px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-44\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We are root. We have just changed the environmental variable of $PATH to tmp and it is running tmp first and it is running our malicious service because it is calling out from that statement \u201cservice apache start\u201d<\/p>\n<p style=\"font-size: 20px\">When we ran the find command earlier, we noticed there was usr\/local\/bin\/suid-env2 binary. This uses a slightly different concept to elevate to root. We first run strings on this binary as shown below:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">strings \/usr\/local\/bin\/suid-env2<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-42 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1097\" height=\"474\" title=\"42\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/42-1.png\" alt class=\"img-responsive wp-image-1676\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/42-1-200x86.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/42-1-400x173.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/42-1-600x259.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/42-1-800x346.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/42-1.png 1097w\" sizes=\"(max-width: 800px) 100vw, 1097px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-45\"><p>\u00a0<\/p>\n<p style=\"font-size: 20px\">We notice that it is caling a direct path \/usr\/sbin\/service apache 2 start <\/p>\n<p style=\"font-size: 20px\">How can we take advantage of this then? We can create a malicious function using the command: <\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">function \/usr\/sbin\/service() <\/p>\n<p style=\"font-size: 20px\">We then export the function created using the command:<\/p>\n<p style=\"font-size: 20px;color: #b51616;text-align: left\">export -f \/usr\/sbin\/service<\/p>\n<p style=\"font-size: 20px\">We then run \/usr\/local\/bin\/suid-env2<\/p>\n<\/div><div class=\"fusion-image-element fusion-image-align-center in-legacy-container\" style=\"text-align:center;--awb-caption-title-font-family:var(--h2_typography-font-family);--awb-caption-title-font-weight:var(--h2_typography-font-weight);--awb-caption-title-font-style:var(--h2_typography-font-style);--awb-caption-title-size:var(--h2_typography-font-size);--awb-caption-title-transform:var(--h2_typography-text-transform);--awb-caption-title-line-height:var(--h2_typography-line-height);--awb-caption-title-letter-spacing:var(--h2_typography-letter-spacing);\"><div class=\"imageframe-align-center\"><span class=\" fusion-imageframe imageframe-none imageframe-43 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1094\" height=\"254\" title=\"43\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/43-1.png\" alt class=\"img-responsive wp-image-1677\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/43-1-200x46.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/43-1-400x93.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/43-1-600x139.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/43-1-800x186.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/43-1.png 1094w\" sizes=\"(max-width: 800px) 100vw, 1094px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-46\"><p>&nbsp;<\/p>\n<p style=\"font-size: 20px\">We get Root!!<\/p>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>Acknowledgement<\/strong><\/h3>\n<p style=\"font-size: 20px\">Thank you very much Heath Adams for creating this lab environment and allowing us to use it to learn the concepts of Privilege escalation via SUIDs.<\/p>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>Reference<\/strong><\/h3>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/academy.tcm-sec.com\/p\/linux-privilege-escalation\">https:\/\/academy.tcm-sec.com\/p\/linux-privilege-escalation<\/a><\/p>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/gtfobins.github.io\/#+suid\">https:\/\/gtfobins.github.io\/#+suid<\/a><\/p>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/tryhackme.com\/room\/vulnversity\">https:\/\/tryhackme.com\/room\/vulnversity<\/a><\/p>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/github.com\/mzet-\/linux-exploit-suggester\">https:\/\/github.com\/mzet-\/linux-exploit-suggester<\/a><\/p>\n<p style=\"font-size: 20px\"><a href=\"https:\/\/github.com\/carlospolop\/privilege-escalation-awesome-scripts-suite\/tree\/master\/linPEAS\">https:\/\/github.com\/carlospolop\/privilege-escalation-awesome-scripts-suite\/tree\/master\/linPEAS<\/a><\/p>\n<\/div><div class=\"fusion-text fusion-text-47\"><p>&nbsp;<\/p>\n<\/div><div class=\"fusion-text fusion-text-48\"><h2 style=\"font-size: 16px;color: #b51616;text-align: left\"><strong>Disclaimer<\/strong><\/h2>\n<p style=\"font-size: 10px\">The MacroSec blogs are solely for informational and educational purposes. Any actions and or activities related to the material contained within this website are solely your responsibility. The misuse of the information on this website can result in criminal charges brought against the persons in question. The authors and MacroSec will not be held responsible in the event any criminal charges be brought against any individuals misusing the information in this website to break the law.<\/p>\n<\/div><div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":5,"featured_media":1702,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[10,8,13],"tags":[],"class_list":["post-1403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-offensive-security","category-pentesting","category-red-teaming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Linux Privilege Escalation Techniques using SUID &#8212; MacroSEC<\/title>\n<meta name=\"description\" content=\"What is SUID? The Set User ID. This has to do with permission settings.So if we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file. So how does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else. Lets try ls -la on \/etc\/shadow which Is something that is definitely owned by root. So root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder. There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. So the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.So in this blog we will be looking at hunting down the S in this location.NOTE: Not everything is vulnerable which has the SUID permission set. So we have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Privilege Escalation Techniques using SUID &#8212; MacroSEC\" \/>\n<meta property=\"og:description\" content=\"What is SUID? The Set User ID. This has to do with permission settings.So if we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file. So how does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else. Lets try ls -la on \/etc\/shadow which Is something that is definitely owned by root. So root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder. There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. So the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.So in this blog we will be looking at hunting down the S in this location.NOTE: Not everything is vulnerable which has the SUID permission set. So we have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/\" \/>\n<meta property=\"og:site_name\" content=\"MacroSEC\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-08T06:00:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-02T12:32:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Dharmik Karania\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dharmik Karania\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"63 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/\"},\"author\":{\"name\":\"Dharmik Karania\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#\\\/schema\\\/person\\\/5d4c800b7e603d391fc1db5b09133e25\"},\"headline\":\"Linux Privilege Escalation Techniques using SUID\",\"datePublished\":\"2021-06-08T06:00:37+00:00\",\"dateModified\":\"2021-09-02T12:32:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/\"},\"wordCount\":12547,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/226772.png\",\"articleSection\":[\"Offensive Security\",\"Penetration Testing\",\"Red Teaming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/\",\"name\":\"Linux Privilege Escalation Techniques using SUID &#8212; MacroSEC\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/226772.png\",\"datePublished\":\"2021-06-08T06:00:37+00:00\",\"dateModified\":\"2021-09-02T12:32:43+00:00\",\"description\":\"What is SUID? The Set User ID. This has to do with permission settings.So if we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file. So how does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else. Lets try ls -la on \\\/etc\\\/shadow which Is something that is definitely owned by root. So root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder. There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. So the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.So in this blog we will be looking at hunting down the S in this location.NOTE: Not everything is vulnerable which has the SUID permission set. So we have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#primaryimage\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/226772.png\",\"contentUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/226772.png\",\"width\":400,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/08\\\/linux-privilege-escalation-techniques-using-suid\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/macrosec.tech\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Privilege Escalation Techniques using SUID\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#website\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/\",\"name\":\"MacroSEC\",\"description\":\"Your Cybersecurity Partner - Kenya\",\"publisher\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/macrosec.tech\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#organization\",\"name\":\"MacroSec Ltd\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/MobileIcon_Retine.png\",\"contentUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/MobileIcon_Retine.png\",\"width\":400,\"height\":107,\"caption\":\"MacroSec Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#\\\/schema\\\/person\\\/5d4c800b7e603d391fc1db5b09133e25\",\"name\":\"Dharmik Karania\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ad5f76a88ad63937e5cbdf80605c372cf663716add095d320f7a27bf084809e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ad5f76a88ad63937e5cbdf80605c372cf663716add095d320f7a27bf084809e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ad5f76a88ad63937e5cbdf80605c372cf663716add095d320f7a27bf084809e?s=96&d=mm&r=g\",\"caption\":\"Dharmik Karania\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux Privilege Escalation Techniques using SUID &#8212; MacroSEC","description":"What is SUID? The Set User ID. This has to do with permission settings.So if we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file. So how does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else. Lets try ls -la on \/etc\/shadow which Is something that is definitely owned by root. So root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder. There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. So the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.So in this blog we will be looking at hunting down the S in this location.NOTE: Not everything is vulnerable which has the SUID permission set. So we have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/","og_locale":"en_US","og_type":"article","og_title":"Linux Privilege Escalation Techniques using SUID &#8212; MacroSEC","og_description":"What is SUID? The Set User ID. This has to do with permission settings.So if we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file. So how does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else. Lets try ls -la on \/etc\/shadow which Is something that is definitely owned by root. So root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder. There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. So the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.So in this blog we will be looking at hunting down the S in this location.NOTE: Not everything is vulnerable which has the SUID permission set. So we have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.","og_url":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/","og_site_name":"MacroSEC","article_published_time":"2021-06-08T06:00:37+00:00","article_modified_time":"2021-09-02T12:32:43+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png","type":"image\/png"}],"author":"Dharmik Karania","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dharmik Karania","Est. reading time":"63 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#article","isPartOf":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/"},"author":{"name":"Dharmik Karania","@id":"https:\/\/macrosec.tech\/#\/schema\/person\/5d4c800b7e603d391fc1db5b09133e25"},"headline":"Linux Privilege Escalation Techniques using SUID","datePublished":"2021-06-08T06:00:37+00:00","dateModified":"2021-09-02T12:32:43+00:00","mainEntityOfPage":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/"},"wordCount":12547,"commentCount":0,"publisher":{"@id":"https:\/\/macrosec.tech\/#organization"},"image":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#primaryimage"},"thumbnailUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png","articleSection":["Offensive Security","Penetration Testing","Red Teaming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/","url":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/","name":"Linux Privilege Escalation Techniques using SUID &#8212; MacroSEC","isPartOf":{"@id":"https:\/\/macrosec.tech\/#website"},"primaryImageOfPage":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#primaryimage"},"image":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#primaryimage"},"thumbnailUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png","datePublished":"2021-06-08T06:00:37+00:00","dateModified":"2021-09-02T12:32:43+00:00","description":"What is SUID? The Set User ID. This has to do with permission settings.So if we look at ls -la, we can see we have, RWX (Read, Write, Execute) and some have Read, then a blank, and then execute permissions. These are the permissions, and we can tell whether it is a directory or a file from the first initial. For example \u201cd\u201d means it is a directory and if it is blank with a dash, it means it is a file. So how does this operate or how do we read and understand these? There are 3 sets of groups. The first is the RWX of the file owner, the second is for the group, and the third is for everybody else. Lets try ls -la on \/etc\/shadow which Is something that is definitely owned by root. So root has RW privileges on it, the group only has read permissions, and the user does not have any permission on this folder. There is the SUID permission, or the Set User ID which allows users to execute a file with permissions of a specified user. So the file with SUID permissions run with higher privileges. If we were to set-UID (SUID) permissions, we would be able to see a \u201cS\u201d in the permissions as shown below.So in this blog we will be looking at hunting down the S in this location.NOTE: Not everything is vulnerable which has the SUID permission set. So we have to basically dig and understand what files have these permissions and why they have these permissions and if it is vulnerable or not.","breadcrumb":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#primaryimage","url":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png","contentUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/226772.png","width":400,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/08\/linux-privilege-escalation-techniques-using-suid\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/macrosec.tech\/"},{"@type":"ListItem","position":2,"name":"Linux Privilege Escalation Techniques using SUID"}]},{"@type":"WebSite","@id":"https:\/\/macrosec.tech\/#website","url":"https:\/\/macrosec.tech\/","name":"MacroSEC","description":"Your Cybersecurity Partner - Kenya","publisher":{"@id":"https:\/\/macrosec.tech\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/macrosec.tech\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/macrosec.tech\/#organization","name":"MacroSec Ltd","url":"https:\/\/macrosec.tech\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/macrosec.tech\/#\/schema\/logo\/image\/","url":"https:\/\/macrosec.tech\/wp-content\/uploads\/2018\/04\/MobileIcon_Retine.png","contentUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2018\/04\/MobileIcon_Retine.png","width":400,"height":107,"caption":"MacroSec Ltd"},"image":{"@id":"https:\/\/macrosec.tech\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/macrosec.tech\/#\/schema\/person\/5d4c800b7e603d391fc1db5b09133e25","name":"Dharmik Karania","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2ad5f76a88ad63937e5cbdf80605c372cf663716add095d320f7a27bf084809e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2ad5f76a88ad63937e5cbdf80605c372cf663716add095d320f7a27bf084809e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2ad5f76a88ad63937e5cbdf80605c372cf663716add095d320f7a27bf084809e?s=96&d=mm&r=g","caption":"Dharmik Karania"}}]}},"_links":{"self":[{"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/posts\/1403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/comments?post=1403"}],"version-history":[{"count":5,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/posts\/1403\/revisions"}],"predecessor-version":[{"id":1838,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/posts\/1403\/revisions\/1838"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/media\/1702"}],"wp:attachment":[{"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/media?parent=1403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/categories?post=1403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/tags?post=1403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}