{"id":1505,"date":"2021-06-22T09:00:17","date_gmt":"2021-06-22T06:00:17","guid":{"rendered":"https:\/\/macrosec.tech\/?p=1505"},"modified":"2021-06-23T12:16:03","modified_gmt":"2021-06-23T09:16:03","slug":"exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild","status":"publish","type":"post","link":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/","title":{"rendered":"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild"},"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\">EXPLOITIING INSECURE DESERALIZATION VULNERABILITIES FOUND IN THE WILD<\/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=\"Hacker Operating A Laptop Cartoon Vector Icon Illustration\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg\" class=\"img-responsive wp-image-1783\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new-200x200.jpg 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg 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\/ian-musyoka-abbbb91bb\">Ian Musyoka<\/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<p style=\"font-size: 20px\">Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended.<\/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=\"804\" height=\"347\" title=\"1\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/1-3.png\" alt class=\"img-responsive wp-image-1515\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/1-3-200x86.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/1-3-400x173.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/1-3-600x259.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/1-3-800x345.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/1-3.png 804w\" sizes=\"(max-width: 800px) 100vw, 804px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-4\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-5\"><p style=\"font-size: 20px\">The importance of serialization and deserialization of data is that it ensures that the object remains a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passed to an unserialized call, allowing an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system.<\/p>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>INSECURE PHP DESERIALIZATION VULNERABILITY<\/strong><\/h3>\n<p style=\"font-size: 20px\">Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected. This allows an attacker to leverage functionality that a particular class can perform, for example, writing files to the system using the file_put_contents() method. This is why the vulnerability is sometimes referred to as Object Injection Vulnerability. Though deserialization of objects from a different class might cause an exception in the web application, the damage might already be done since most deserialization processes are completed before the deserialization process finishes. In Insecure PHP deserialization we jump to functions that have magic methods for example, __wakeup (), __destruct (), __toString ()<\/p>\n<p style=\"font-size: 20px\">To demonstrate the vulnerability, I\u2019ll use a system fromTryHackMe called debug.<\/p>\n<p style=\"font-size: 20px\">When we do an nmap scan of the box we see that the port has two ports open.<\/p>\n<ol style=\"font-size: 20px\">\n<li>SSH (Secure Shell)<\/li>\n<li>HTTP<\/li>\n<\/ol>\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=\"1482\" height=\"597\" title=\"2\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2.png\" alt class=\"img-responsive wp-image-1519\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2-200x81.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2-400x161.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2-600x242.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2-800x322.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2-1200x483.png 1200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/2-2.png 1482w\" sizes=\"(max-width: 800px) 100vw, 1200px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-6\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-7\"><p style=\"font-size: 20px\">On opening the web application, we get a standard webpage with nothing too interesting. The next logical step is to do a directory brute force and I normally use the tool &#8211; gobuster.<\/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=\"1483\" height=\"531\" title=\"3\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2.png\" alt class=\"img-responsive wp-image-1520\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2-200x72.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2-400x143.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2-600x215.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2-800x286.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2-1200x430.png 1200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/3-2.png 1483w\" sizes=\"(max-width: 800px) 100vw, 1200px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-8\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-9\"><p style=\"font-size: 20px\">Looking at the results returned by gobuster we have a backup directory and index.php 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-5 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1173\" height=\"670\" title=\"4\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-2.png\" alt class=\"img-responsive wp-image-1525\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-2-200x114.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-2-400x228.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-2-600x343.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-2-800x457.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/4-2.png 1173w\" sizes=\"(max-width: 800px) 100vw, 1173px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-10\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-11\"><p style=\"font-size: 20px\">Looking at the backup folder we have an index.php backup file. I downloaded the file and reviewed the PHP Source code to see if we could find any vulnerabilities.<\/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-6 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1171\" height=\"430\" title=\"5\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-2.png\" alt class=\"img-responsive wp-image-1526\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-2-200x73.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-2-400x147.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-2-600x220.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-2-800x294.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/5-2.png 1171w\" sizes=\"(max-width: 800px) 100vw, 1171px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-12\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-13\"><p style=\"font-size: 20px\">Looking at line 216 of the code we see that it uses the unserialize() call which deserializes any byte stream that is provided through the debug GET parameter.<\/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=\"1174\" height=\"631\" title=\"6\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/6-2.png\" alt class=\"img-responsive wp-image-1527\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/6-2-200x107.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/6-2-400x215.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/6-2-600x322.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/6-2-800x430.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/6-2.png 1174w\" sizes=\"(max-width: 800px) 100vw, 1174px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-14\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-15\"><p style=\"font-size: 20px\">Also looking through the source code we see that the class FormSubmit has a function that uses the magic method __destruct ()<\/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=\"1173\" height=\"630\" title=\"7\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-2.png\" alt class=\"img-responsive wp-image-1528\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-2-200x107.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-2-400x215.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-2-600x322.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-2-800x430.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/7-2.png 1173w\" sizes=\"(max-width: 800px) 100vw, 1173px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-16\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-17\"><p style=\"font-size: 20px\">We can abuse the file_put_contents () functionality to drop a web shell on the system. I created a PHP exploit script that creates a serialized object which when passed to the debug parameter on the web application should drop a shell on the system.<\/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=\"1171\" height=\"457\" title=\"8\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-3.png\" alt class=\"img-responsive wp-image-1529\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-3-200x78.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-3-400x156.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-3-600x234.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-3-800x312.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/8-3.png 1171w\" sizes=\"(max-width: 800px) 100vw, 1171px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-18\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-19\"><p style=\"font-size: 20px\">On executing the PHP exploit script, it generates a serialized payload.<\/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=\"1169\" height=\"150\" title=\"9\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-3.png\" alt class=\"img-responsive wp-image-1530\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-3-200x26.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-3-400x51.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-3-600x77.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-3-800x103.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/9-3.png 1169w\" sizes=\"(max-width: 800px) 100vw, 1169px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-20\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-21\"><p style=\"font-size: 20px\">On submitting the payload to the server we see that nothing changes.<\/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=\"1166\" height=\"632\" title=\"10\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-2.png\" alt class=\"img-responsive wp-image-1531\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-2-200x108.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-2-400x217.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-2-600x325.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-2-800x434.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/10-2.png 1166w\" sizes=\"(max-width: 800px) 100vw, 1166px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-22\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-23\"><p style=\"font-size: 20px\">However, if we try to access the file macrosec.php which the serialized payload was supposed to create, we notice that it exists because we do not get a 404 error.<\/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=\"1171\" height=\"223\" title=\"11\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-2.png\" alt class=\"img-responsive wp-image-1532\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-2-200x38.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-2-400x76.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-2-600x114.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-2-800x152.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/11-2.png 1171w\" sizes=\"(max-width: 800px) 100vw, 1171px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-24\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-25\"><p style=\"font-size: 20px\">I then add the cmd parameter which we had specified on the script and I try to execute System commands. We see that it works and we now have code execution on the system.<\/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=\"1180\" height=\"190\" title=\"12\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-2.png\" alt class=\"img-responsive wp-image-1533\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-2-200x32.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-2-400x64.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-2-600x97.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-2-800x129.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/12-2.png 1180w\" sizes=\"(max-width: 800px) 100vw, 1180px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-26\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-27\"><p style=\"font-size: 20px\">The next step is getting a reverse shell on the system. I created a Netcat listener on my box.<\/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=\"1171\" height=\"192\" title=\"13\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-2.png\" alt class=\"img-responsive wp-image-1534\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-2-200x33.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-2-400x66.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-2-600x98.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-2-800x131.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/13-2.png 1171w\" sizes=\"(max-width: 800px) 100vw, 1171px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-28\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-29\"><p style=\"font-size: 20px\">Using the web shell backdoor we had created on the system, we execute a bash reverse shell and get a shell back on our box from the system.<\/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=\"1174\" height=\"435\" title=\"14\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-2.png\" alt class=\"img-responsive wp-image-1535\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-2-200x74.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-2-400x148.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-2-600x222.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-2-800x296.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/14-2.png 1174w\" sizes=\"(max-width: 800px) 100vw, 1174px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-30\"><p>\u00a0<\/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=\"1173\" height=\"325\" title=\"15\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-2.png\" alt class=\"img-responsive wp-image-1536\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-2-200x55.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-2-400x111.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-2-600x166.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-2-800x222.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/15-2.png 1173w\" sizes=\"(max-width: 800px) 100vw, 1173px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-31\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-32\"><h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>INSECURE NODE JS EXPRESS FRAMEWORK DESERIALIZATION VULNERABILITY<\/strong><\/h3>\n<p style=\"font-size: 20px\">In Node JS, deserialization vulnerability exists when an untrusted user-controlled data is passed to an unserialized call leading to remote code execution since the object that has &#8220;:&#8221;_$$ND_FUNC passes to an eval() statement.<\/p>\n<p style=\"font-size: 20px\">The &#8220;:&#8221;_$$ND_FUNC is declared in a variable called FUNC 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-17 hover-type-none\" style=\"border:5px solid #e2e0e0;\"><img decoding=\"async\" width=\"1174\" height=\"643\" title=\"16\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-2.png\" alt class=\"img-responsive wp-image-1539\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-2-200x110.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-2-400x219.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-2-600x329.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-2-800x438.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/16-2.png 1174w\" sizes=\"(max-width: 800px) 100vw, 1174px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-33\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-34\"><p style=\"font-size: 20px\">And Looking through the source code we see that the FUNCFLAG is passed to an eval() function and this leads to code execution on the system.<\/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=\"1172\" height=\"653\" title=\"17\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-2.png\" alt class=\"img-responsive wp-image-1540\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-2-200x111.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-2-400x223.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-2-600x334.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-2-800x446.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/17-2.png 1172w\" sizes=\"(max-width: 800px) 100vw, 1172px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-35\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-36\"><p style=\"font-size: 20px\">To demonstrate the vulnerability, I\u2019ve used a system from TryHackMe. Looking through the Nmap results we notice that the web application is running node JS framework.<\/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=\"1174\" height=\"525\" title=\"18\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-2.png\" alt class=\"img-responsive wp-image-1541\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-2-200x89.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-2-400x179.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-2-600x268.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-2-800x358.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/18-2.png 1174w\" sizes=\"(max-width: 800px) 100vw, 1174px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-37\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-38\"><p style=\"font-size: 20px\">When we open the web application, we get a standard web page. However, when we send the request to burpsuite we see that there\u2019s a cookie assigned to us.<\/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=\"1172\" height=\"357\" title=\"19\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-2.png\" alt class=\"img-responsive wp-image-1542\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-2-200x61.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-2-400x122.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-2-600x183.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-2-800x244.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/19-2.png 1172w\" sizes=\"(max-width: 800px) 100vw, 1172px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-39\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-40\"><p style=\"font-size: 20px\">On examining the cookie, we find out that it\u2019s a JSON object and it\u2019s a cookie belonging to the guest user. My first thought was to try to convert the cookie to impersonate the admin user of the web application. I changed some values on the JSON object and encoded the cookie with base64 encoding and URL encoding.<\/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=\"1182\" height=\"380\" title=\"20\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-2.png\" alt class=\"img-responsive wp-image-1543\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-2-200x64.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-2-400x129.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-2-600x193.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-2-800x257.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/20-2.png 1182w\" sizes=\"(max-width: 800px) 100vw, 1182px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-41\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-42\"><p style=\"font-size: 20px\">I then copied the cookie to the request and ran it. Looking at the response we get from the web application, we see that we were able to impersonate the admin user of the web application but we are still asked to log into the web application.<\/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=\"1180\" height=\"612\" title=\"21\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/21-2.png\" alt class=\"img-responsive wp-image-1544\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/21-2-200x104.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/21-2-400x207.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/21-2-600x311.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/21-2-800x415.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/21-2.png 1180w\" sizes=\"(max-width: 800px) 100vw, 1180px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-43\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-44\"><p style=\"font-size: 20px\">We are sure that the web application is utilizing the cookie somehow just not how we thought. Next, I tried deleting a section of the cookie and see if the web application would cough out an error or stack trace messages. We see that the web application throws errors and it shows a stack trace error indicating that the cookie wasn\u2019t deserialized correctly.<\/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=\"1181\" height=\"635\" title=\"22\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-2.png\" alt class=\"img-responsive wp-image-1545\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-2-200x108.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-2-400x215.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-2-600x323.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-2-800x430.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/22-2.png 1181w\" sizes=\"(max-width: 800px) 100vw, 1181px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-45\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-46\"><p style=\"font-size: 20px\">I then searched online for Node JS deserialization vulnerability and I came across an interesting article from opsecx. A Sample payload was even provided.<\/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=\"1176\" height=\"644\" title=\"23\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-2.png\" alt class=\"img-responsive wp-image-1546\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-2-200x110.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-2-400x219.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-2-600x329.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-2-800x438.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/23-2.png 1176w\" sizes=\"(max-width: 800px) 100vw, 1176px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-47\"><p>\u00a0<\/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=\"1144\" height=\"150\" title=\"24\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-2.png\" alt class=\"img-responsive wp-image-1547\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-2-200x26.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-2-400x52.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-2-600x79.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-2-800x105.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/24-2.png 1144w\" sizes=\"(max-width: 800px) 100vw, 1144px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-48\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-49\"><p style=\"font-size: 20px\">So we craft a payload using the sample payload already provided. Looking at the payload, it is supposed to create a reverse shell to the attacker box using the IP Address provided.<\/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=\"1173\" height=\"375\" title=\"25\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-2.png\" alt class=\"img-responsive wp-image-1548\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-2-200x64.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-2-400x128.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-2-600x192.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-2-800x256.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/25-2.png 1173w\" sizes=\"(max-width: 800px) 100vw, 1173px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-50\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-51\"><p style=\"font-size: 20px\">Before sending the payload we create a Netcat listener to our box.<\/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=\"1171\" height=\"198\" title=\"26\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26.png\" alt class=\"img-responsive wp-image-1549\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-200x34.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-400x68.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-600x101.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26-800x135.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/26.png 1171w\" sizes=\"(max-width: 800px) 100vw, 1171px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-52\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-53\"><p style=\"font-size: 20px\">We then send the serialized payload to the server using the request we already intercepted.<\/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=\"1176\" height=\"626\" title=\"27\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27.png\" alt class=\"img-responsive wp-image-1550\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-200x106.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-400x213.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-600x319.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27-800x426.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/27.png 1176w\" sizes=\"(max-width: 800px) 100vw, 1176px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-54\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-55\"><p style=\"font-size: 20px\">Going back to our Netcat listener, we have a shell on the victim\u2019s box.<\/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=\"1172\" height=\"336\" title=\"28\" src=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28.png\" alt class=\"img-responsive wp-image-1551\" srcset=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-200x57.png 200w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-400x115.png 400w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-600x172.png 600w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28-800x229.png 800w, https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/28.png 1172w\" sizes=\"(max-width: 800px) 100vw, 1172px\" \/><\/span><\/div><\/div><div class=\"fusion-text fusion-text-56\"><p>\u00a0<\/p>\n<\/div><div class=\"fusion-text fusion-text-57\"><p style=\"font-size: 20px\">Insecure deserialization is a really difficult vulnerability to find if you are performing a black-box penetration test on a particular system. However, deserialization might be identified by:<\/p>\n<ol style=\"font-size: 20px\">\n<li style=\"list-style-type: none\">\n<ol style=\"font-size: 20px\">\n<li>By seeing chucks of base64 encoded data traversing through a network.<\/li>\n<li>By using another vulnerability like Local File inclusion to leak the source code of the web application (This is where the concept of chaining vulnerability comes in handy).<\/li>\n<li>By coming across a source code backup of the web application.<\/li>\n<li>Through Fuzzing the web application using a common wordlist. Personally, I recommend Seclists and Web Application Fuzzers (ffuf,burpsuite and wfuzz).<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h3 style=\"font-size: 22px;color: #b51616;text-align: left\"><strong>Insecure deserialization can be prevented through the following methods<\/strong><\/h3>\n<ol style=\"font-size: 20px\">\n<li style=\"list-style-type: none\">\n<ol style=\"font-size: 20px\">\n<li>Validation: making sure that the user input meets a certain criterion. Use whitelisting of expected types\/data.<\/li>\n<li>Verification: if the input is valid, check for integrity using Digital signatures on the serialized objects. This will prevent tampering.<\/li>\n<li>Isolate and run deserialization code in a low privileged environment.<\/li>\n<li>Constantly monitor deserialization activities on servers since it makes the job of blue teamers easier in case incident response is ever required in case of a breach.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/div><div class=\"fusion-text fusion-text-58\"><p>\u00a0<\/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-text fusion-text-59\"><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":1783,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[10,8,13],"tags":[],"class_list":["post-1505","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>Exploiting Insecure Deserialization Vulnerabilities Found in the Wild &#8212; MacroSEC<\/title>\n<meta name=\"description\" content=\"Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended. The importance of serialization and deserialization of data is it ensure that the object remain a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passes to a unserialize call, it can cause an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system. In Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected this in turn cause an attacker to leverage an functionality that a particular class can perform example which including writing file to the system using file_put_contents() method.\" \/>\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\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild &#8212; MacroSEC\" \/>\n<meta property=\"og:description\" content=\"Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended. The importance of serialization and deserialization of data is it ensure that the object remain a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passes to a unserialize call, it can cause an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system. In Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected this in turn cause an attacker to leverage an functionality that a particular class can perform example which including writing file to the system using file_put_contents() method.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/\" \/>\n<meta property=\"og:site_name\" content=\"MacroSEC\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-22T06:00:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-23T09:16:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg\" \/>\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\/jpeg\" \/>\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=\"47 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\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/\"},\"author\":{\"name\":\"Dharmik Karania\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#\\\/schema\\\/person\\\/5d4c800b7e603d391fc1db5b09133e25\"},\"headline\":\"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild\",\"datePublished\":\"2021-06-22T06:00:17+00:00\",\"dateModified\":\"2021-06-23T09:16:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/\"},\"wordCount\":9433,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/new.jpg\",\"articleSection\":[\"Offensive Security\",\"Penetration Testing\",\"Red Teaming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/\",\"name\":\"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild &#8212; MacroSEC\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/new.jpg\",\"datePublished\":\"2021-06-22T06:00:17+00:00\",\"dateModified\":\"2021-06-23T09:16:03+00:00\",\"description\":\"Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended. The importance of serialization and deserialization of data is it ensure that the object remain a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passes to a unserialize call, it can cause an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system. In Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected this in turn cause an attacker to leverage an functionality that a particular class can perform example which including writing file to the system using file_put_contents() method.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#primaryimage\",\"url\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/new.jpg\",\"contentUrl\":\"https:\\\/\\\/macrosec.tech\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/new.jpg\",\"width\":400,\"height\":400,\"caption\":\"Hacker Operating A Laptop Cartoon Vector Icon Illustration. Technology Icon Concept Isolated Premium Vector. Flat Cartoon Style\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/macrosec.tech\\\/index.php\\\/2021\\\/06\\\/22\\\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/macrosec.tech\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild\"}]},{\"@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":"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild &#8212; MacroSEC","description":"Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended. The importance of serialization and deserialization of data is it ensure that the object remain a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passes to a unserialize call, it can cause an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system. In Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected this in turn cause an attacker to leverage an functionality that a particular class can perform example which including writing file to the system using file_put_contents() method.","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\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/","og_locale":"en_US","og_type":"article","og_title":"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild &#8212; MacroSEC","og_description":"Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended. The importance of serialization and deserialization of data is it ensure that the object remain a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passes to a unserialize call, it can cause an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system. In Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected this in turn cause an attacker to leverage an functionality that a particular class can perform example which including writing file to the system using file_put_contents() method.","og_url":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/","og_site_name":"MacroSEC","article_published_time":"2021-06-22T06:00:17+00:00","article_modified_time":"2021-06-23T09:16:03+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg","type":"image\/jpeg"}],"author":"Dharmik Karania","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dharmik Karania","Est. reading time":"47 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#article","isPartOf":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/"},"author":{"name":"Dharmik Karania","@id":"https:\/\/macrosec.tech\/#\/schema\/person\/5d4c800b7e603d391fc1db5b09133e25"},"headline":"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild","datePublished":"2021-06-22T06:00:17+00:00","dateModified":"2021-06-23T09:16:03+00:00","mainEntityOfPage":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/"},"wordCount":9433,"commentCount":0,"publisher":{"@id":"https:\/\/macrosec.tech\/#organization"},"image":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#primaryimage"},"thumbnailUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg","articleSection":["Offensive Security","Penetration Testing","Red Teaming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/","url":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/","name":"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild &#8212; MacroSEC","isPartOf":{"@id":"https:\/\/macrosec.tech\/#website"},"primaryImageOfPage":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#primaryimage"},"image":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#primaryimage"},"thumbnailUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg","datePublished":"2021-06-22T06:00:17+00:00","dateModified":"2021-06-23T09:16:03+00:00","description":"Deserialization is the process of converting a byte stream back into an object so that it can be used by the web application the way it was intended. The importance of serialization and deserialization of data is it ensure that the object remain a replica of the original object before it was serialized. Insecure deserialization comes when unsanitized user-controlled data is passes to a unserialize call, it can cause an attacker to leverage the vulnerability which in turn leads to code execution or arbitrary file read on any system. In Insecure PHP deserialization object of any class can be deserialized and instantiated regardless of the class which was expected this in turn cause an attacker to leverage an functionality that a particular class can perform example which including writing file to the system using file_put_contents() method.","breadcrumb":{"@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#primaryimage","url":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg","contentUrl":"https:\/\/macrosec.tech\/wp-content\/uploads\/2021\/05\/new.jpg","width":400,"height":400,"caption":"Hacker Operating A Laptop Cartoon Vector Icon Illustration. Technology Icon Concept Isolated Premium Vector. Flat Cartoon Style"},{"@type":"BreadcrumbList","@id":"https:\/\/macrosec.tech\/index.php\/2021\/06\/22\/exploiting-insecure-deserialization-vulnerabilities-found-in-the-wild\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/macrosec.tech\/"},{"@type":"ListItem","position":2,"name":"Exploiting Insecure Deserialization Vulnerabilities Found in the Wild"}]},{"@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\/1505","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=1505"}],"version-history":[{"count":5,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/posts\/1505\/revisions"}],"predecessor-version":[{"id":1784,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/posts\/1505\/revisions\/1784"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/media\/1783"}],"wp:attachment":[{"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/media?parent=1505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/categories?post=1505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/macrosec.tech\/index.php\/wp-json\/wp\/v2\/tags?post=1505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}