{"id":978,"date":"2020-08-16T17:16:00","date_gmt":"2020-08-16T16:16:00","guid":{"rendered":"http:\/\/zerothcode.com\/blog\/?p=978"},"modified":"2020-08-16T17:16:00","modified_gmt":"2020-08-16T16:16:00","slug":"cracking-the-2fa","status":"publish","type":"post","link":"https:\/\/zerothcode.com\/blog\/cracking-the-2fa\/","title":{"rendered":"Cracking the 2FA"},"content":{"rendered":"<p id=\"ce88\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">Cracking &#8211; Testing a 2FA system is so much fun because we are breaching the stuff that was meant for additional security. And breaking them is so fun. You can skip to the part wherein the end I have explained the bug. Below are basics of response manipulation<\/p>\n<p id=\"01fe\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\"><strong class=\"hd id\">What is Two-Factor Authorization? Cracking<\/strong><\/p>\n<h4 id=\"09c7\" class=\"ie if bo bn db ig ih ii ij ik il im in io ip iq ir is it iu iv de\">Two-factor authentication (2FA) is the second layer of security to protect an account or system. Users must go through two layers of security before being granted access to an account or system.<\/h4>\n<h4 id=\"e63b\" class=\"ie if bo bn db ig ih ii ij ik il im in io ip iq ir is it iu iv de\">What is Response Manipulation? Cracking<\/h4>\n<p id=\"ad24\" class=\"hb hc bo hd b he iw hg hh hi ix hk hl hm iy ho hp hq iz hs ht hu ja hw hx hy ef de\" data-selectable-paragraph=\"\">So normally what we do in burp suite is we browse through multiple requests and wherever we wanna tamper or change anything we do it and forward the request.<\/p>\n<figure class=\"jc jd je jf jg jh dz ea paragraph-image\">\n<div class=\"dz ea jb\">\n<div class=\"jl r df dn\">\n<div class=\"jm jn r\">\n<div class=\"cd ji s t u by ai fq jj jk\"><\/div>\n<figure style=\"width: 690px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"co tb s t u by ai c\" src=\"https:\/\/miro.medium.com\/max\/690\/1*UOcaj0vZp7Hq-ghnXlTZ-w.png\" sizes=\"auto, 690px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*UOcaj0vZp7Hq-ghnXlTZ-w.png 276w, https:\/\/miro.medium.com\/max\/552\/1*UOcaj0vZp7Hq-ghnXlTZ-w.png 552w, https:\/\/miro.medium.com\/max\/640\/1*UOcaj0vZp7Hq-ghnXlTZ-w.png 640w, https:\/\/miro.medium.com\/max\/690\/1*UOcaj0vZp7Hq-ghnXlTZ-w.png 690w\" alt=\"Cracking\" width=\"690\" height=\"198\" \/><figcaption class=\"wp-caption-text\">Cracking<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"148f\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">In Response Manipulation, we need to look for the appropriate request click on the \u201cAction\u201d button next to the \u201cIntercept\u201d button and select \u201cDo Intercept\u201d &gt; \u201cResponse to Request\u201d.<\/p>\n<figure class=\"jc jd je jf jg jh dz ea paragraph-image\">\n<div class=\"js jt df ju ai\">\n<div class=\"dz ea jr\">\n<div class=\"jl r df dn\">\n<div class=\"jv jn r\">\n<div class=\"cd ji s t u by ai fq jj jk\"><\/div>\n<figure style=\"width: 760px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"co tb s t u by ai c\" src=\"https:\/\/miro.medium.com\/max\/760\/1*cSbxvFxIXhFWGqJY6QI8hw.png\" alt=\"Cracking\" width=\"760\" height=\"573\" \/><figcaption class=\"wp-caption-text\">Cracking<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"jw jx eb dz ea jy jz bn fo fp bp bs\" data-selectable-paragraph=\"\">How to get a response to the request<\/figcaption><\/figure>\n<p id=\"1717\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">In Response manipulation, we tamper with the data that comes from the server.<\/p>\n<figure class=\"jc jd je jf jg jh dz ea paragraph-image\">\n<div class=\"js jt df ju ai\">\n<div class=\"dz ea ka\">\n<div class=\"jl r df dn\">\n<div class=\"kb jn r\">\n<div class=\"cd ji s t u by ai fq jj jk\"><\/div>\n<figure style=\"width: 741px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"co tb s t u by ai c\" src=\"https:\/\/miro.medium.com\/max\/741\/1*RKqxIdaJPpyFA4x6RSQgvg.png\" alt=\"Cracking\" width=\"741\" height=\"344\" \/><figcaption class=\"wp-caption-text\">Cracking<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"jw jx eb dz ea jy jz bn fo fp bp bs\" data-selectable-paragraph=\"\">Response Manipulation<\/figcaption><\/figure>\n<p id=\"6086\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">So let\u2019s move on to see the bug,<\/p>\n<p id=\"aeb6\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">It is a private program so let\u2019s continue by saying it\u00a0<strong class=\"hd id\">example.com<\/strong>\u00a0and it had 2FA for account protection and it was well implemented no brute-force or whatever other methods, this also had a \u201cuse recovery codes option\u201d and decided to test that and then I remembered reading some blogs which told that with burp suite we cannot just manipulate requests going to browser but also the incoming responses. So me being a noob still decided to try for this thing I read of response manipulation.<\/p>\n<p id=\"1925\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">Steps:-<\/p>\n<p id=\"2c0e\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">1) Enable the 2FA for Attacker and Victims account, I used Google Authenticator and Microsoft Authenticator respectively just to keep no ties between them you know how the private programs are many questions and doubts from the teams.<\/p>\n<p id=\"bd8c\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">2) Then Go to attackers\u2019 account and log in and you\u2019ll see \u201cPlease enter your 2FA code \u201c And also an option just below it \u201cUse Recovery Code\u201d (Codes provide as backups when you don\u2019t have access to your authentication application or lost the device). Cracking<\/p>\n<p id=\"ee99\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">3)Select the\u00a0<strong class=\"hd id\">\u201cUse Recovery Code\u201d Option<\/strong>\u00a0and Now Enter a correct backup code for the Attacker\u2019s account and intercept the request and get the response of that request. The Response has a session token for security purposes called _example_session=somenos. and string message showing correct code message.<\/p>\n<figure class=\"jc jd je jf jg jh dz ea paragraph-image\">\n<div class=\"dz ea kc\">\n<div class=\"jl r df dn\">\n<div class=\"kd jn r\">\n<div class=\"cd ji s t u by ai fq jj jk\"><\/div>\n<figure style=\"width: 633px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"co tb s t u by ai c\" src=\"https:\/\/miro.medium.com\/max\/633\/1*qO5RxGrbLkybCUEkQOYjSg.png\" sizes=\"auto, 633px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*qO5RxGrbLkybCUEkQOYjSg.png 276w, https:\/\/miro.medium.com\/max\/552\/1*qO5RxGrbLkybCUEkQOYjSg.png 552w, https:\/\/miro.medium.com\/max\/633\/1*qO5RxGrbLkybCUEkQOYjSg.png 633w\" alt=\"Cracking\" width=\"633\" height=\"540\" \/><figcaption class=\"wp-caption-text\">Cracking<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"jw jx eb dz ea jy jz bn fo fp bp bs\" data-selectable-paragraph=\"\">The Response you get On Entering a correct recovery Code<\/figcaption><\/figure>\n<p id=\"bb04\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">4)Copy This response and keep it on a notepad. Cracking<\/p>\n<p id=\"3414\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">4)Now, this is where the<strong class=\"hd id\">\u00a0criticality of this bug is<\/strong>;\u00a0<strong class=\"hd id\">Drop<\/strong>\u00a0<strong class=\"hd id\">the Response<\/strong>\u00a0what it does is stops the _example_session token going to websites server and the web application does not invalidate that token.<\/p>\n<p id=\"9c40\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">5)Now go to the victim\u2019s account follow the same steps for that of attackers (Step 1,2,). But while performing Step 3 enter a wrong recovery code any number you want. Capture the Request and get its response. You\u2019ll see that no session token provided to the error response that means we need a session token and there was an error string.<\/p>\n<figure class=\"jc jd je jf jg jh dz ea paragraph-image\">\n<div class=\"dz ea ke\">\n<div class=\"jl r df dn\">\n<div class=\"kf jn r\">\n<div class=\"cd ji s t u by ai fq jj jk\"><\/div>\n<figure style=\"width: 603px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"co tb s t u by ai c\" src=\"https:\/\/miro.medium.com\/max\/603\/1*IeP5gv8b4EknSQ9QufsLaQ.png\" sizes=\"auto, 603px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*IeP5gv8b4EknSQ9QufsLaQ.png 276w, https:\/\/miro.medium.com\/max\/552\/1*IeP5gv8b4EknSQ9QufsLaQ.png 552w, https:\/\/miro.medium.com\/max\/603\/1*IeP5gv8b4EknSQ9QufsLaQ.png 603w\" alt=\"Cracking\" width=\"603\" height=\"537\" \/><figcaption class=\"wp-caption-text\">Cracking<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"jw jx eb dz ea jy jz bn fo fp bp bs\" data-selectable-paragraph=\"\">The response you get on entering the wrong recovery code<\/figcaption><\/figure>\n<p id=\"4d98\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">6)Now We had our attacker\u2019s account response from server replace that response to the error response here for victim&#8217;s account and \u2026\u2026\u2026\u2026 Cracking<\/p>\n<figure class=\"jc jd je jf jg jh dz ea paragraph-image\">\n<div class=\"dz ea kg\">\n<div class=\"jl r df dn\">\n<div class=\"kh jn r\">\n<div class=\"cd ji s t u by ai fq jj jk\"><\/div>\n<figure style=\"width: 500px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"co tb s t u by ai c\" src=\"https:\/\/miro.medium.com\/max\/500\/1*rD3O7LrqDR6fK5R1e1GuEw.gif\" sizes=\"auto, 500px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*rD3O7LrqDR6fK5R1e1GuEw.gif 276w, https:\/\/miro.medium.com\/max\/500\/1*rD3O7LrqDR6fK5R1e1GuEw.gif 500w\" alt=\"Cracking\" width=\"500\" height=\"226\" \/><figcaption class=\"wp-caption-text\">Cracking<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h1 id=\"d2d8\" class=\"ie if bo bn db ig ih ii ij ik il im in io ip iq ir is it iu iv de\" data-selectable-paragraph=\"\">What Went Wrong?<\/h1>\n<p id=\"bdbf\" class=\"hb hc bo hd b he iw hg hh hi ix hk hl hm iy ho hp hq iz hs ht hu ja hw hx hy ef de\" data-selectable-paragraph=\"\">1)Session token called _example_session= is not invalidated on the server-side when assigned someone and not got back.<\/p>\n<p id=\"452d\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">2)Security is totally left on a string error message response I mean there was a security measure but due to invalidation of tokens, the security could be bypassed.<\/p>\n<p id=\"9cce\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\"><strong class=\"hd id\">Conclusion<\/strong><\/p>\n<p id=\"13ce\" class=\"hb hc bo hd b he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy ef de\" data-selectable-paragraph=\"\">Always make sure Session tokens are properly validated and when sending a response back make sure it has some identity tokens attached to it.<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"khzFaHGePa\"><p><a href=\"https:\/\/zerothcode.com\/blog\/use-malicious-softwares\/\">How to use Malicious Softwares?<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;How to use Malicious Softwares?&#8221; &#8212; ZEROTHCODE\" src=\"https:\/\/zerothcode.com\/blog\/use-malicious-softwares\/embed\/#?secret=khzFaHGePa\" data-secret=\"khzFaHGePa\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>Read : <a href=\"http:\/\/zerothcode.com\/blog\/burp-suite-monitor-endpoints\/\">http:\/\/zerothcode.com\/blog\/burp-suite-monitor-endpoints\/<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cracking &#8211; Testing a 2FA system is so much fun because we are breaching the stuff that was meant for<\/p>\n","protected":false},"author":1,"featured_media":979,"comment_status":"closed","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":[1188,801,65,117,260,655],"class_list":["post-978","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\/978","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=978"}],"version-history":[{"count":0,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/posts\/978\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/media\/979"}],"wp:attachment":[{"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/media?parent=978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/categories?post=978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/tags?post=978"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/zerothcode.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}