TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Challenge: can you view my source?

48 pointsby colewilsonover 3 years ago

16 comments

jim_dtrsecover 3 years ago
I cheated and used REnigma to make a recording of chrome.exe running the alert in a VM. Then I found an execution point where the alert was on screen, made a memory dump, and ran the strings analysis the chrome.exe parent process (which acts as a sandbox for the rendering processes and handles all system interactions). That gave me the all of the virtual addresses where that string existed (there were several copies). I then hooked up GDB to remotely debug the replay at that execution point and dumped the strings near that address to extract the complete file.<p>0x25ca4b13381: &quot;\t&#x2F;<i>&lt;202e&gt;</i>&#x2F;if(!window._enabled){window._enabled=true;document.querySelector(\&quot;button\&quot;).addEventListener(\&quot;click\&quot;,function(){alert(&#x27;where is the source for this alert()?&#x27;);});};&#x2F;<i>&lt;202e&gt;</i>&#x2F;;function isTouchDevic&quot;... (gdb) 0x25ca4b13449: &quot;e(){return true;&#x2F;<i>&lt;202e&gt;</i>&#x2F;;return((&#x27;ontouchstart&#x27;in window)||(navigator.maxTouchPoints&gt;0)||(navigator.msMaxTouchPoints&gt;0));};&#x2F;<i>&lt;202e&gt;</i>&#x2F;;if(!isTouchDevice()){setTimeout(function(){setInterval(function(){if(g&quot;... (gdb) 0x25ca4b13511: &quot;etComputedStyle(document.documentElement).color==\&quot;rgb(0, 0, 0)\&quot;)action()},100)},90)};&#x2F;<i>&lt;202e&gt;</i>&#x2F;;function action(t){if(t==&#x27;0&#x27;)return;&#x2F;<i>&lt;202e&gt;</i>&#x2F;;window.history.pushState(\&quot;.\&quot;,\&quot;&#x2F;haha\&quot;,\&quot;&#x2F;haha\&quot;);location=\&quot;&#x2F;haha\&quot;;&quot;... (gdb) 0x25ca4b135d9: &quot;};&#x2F;<i>&lt;202e&gt;</i>&#x2F;;function addScript(){var my_awesome_script=document.createElement(&#x27;script&#x27;);my_awesome_script.setAttribute(&#x27;src&#x27;,&#x27;main.js?i=d9c89773dd&#x27;);document.body.appendChild(my_awesome_script);};&#x2F;<i>&lt;202e&gt;</i>&quot;... (gdb) 0x25ca4b136a1: &quot;&#x2F;;async function _noscript(key){setInterval(addScript,1000);console.log(\&quot;%c\&quot;+key,\&quot;background-image:url(&#x2F;ping?type=img&amp;key=\&quot;+key+\&quot;)\&quot;);setInterval(function(){fetch(\&quot;&#x2F;get?key=\&quot;+key).then((r)=&gt;r.text()).t&quot;... (gdb) 0x25ca4b13769: &quot;hen((t)=&gt;action(t))},1000)};&#x2F;<i>&lt;202e&gt;</i>&#x2F;;_noscript(`8JWFZ`);\n&#x2F;&#x2F;# sourceMappingURL=&#x2F;ping?type=src&amp;key=8JWFZ\n&#x2F;&#x2F;\a\033[2Jnothing to see here!\257\244\\\002&quot;
评论 #29439327 未加载
sandreasover 3 years ago
I really appreciate to not see the full solutions in the comments :-) Was a very nice puzzle and I would appreciate an article by the author on how it is exactly done and how he came up with the idea...<p>Thanks man.
karmakazeover 3 years ago
My user agent can execute it, so I presume if I were to make the same requests in the same order with the same params, I&#x27;d be able to see it. I don&#x27;t care to actually do it though, only to know that it could be done if there was actual motivation.
评论 #29434537 未加载
robgibbonsover 3 years ago
Cole added a v2 after a few dozen folks solved the first version. v2 was a bit trickier, but took me about the same amount of time since I didn&#x27;t have to solve it all from scratch, just the weird new bits. Looking forward to v3!
_Microftover 3 years ago
The button doesn&#x27;t do anything in Firefox or Edge by the way.
评论 #29433465 未加载
dalmo3over 3 years ago
Just reading the page is challenge in itself. It seems to timeout after 5 seconds and redirects to &#x2F;haha. (Chrome&#x2F;Android)
评论 #29434707 未加载
emurlinover 3 years ago
Got it (although it doesn&#x27;t seem to work on MSIE), which I guess is fine. However, it reminded me of <a href="https:&#x2F;&#x2F;www.sitepoint.com&#x2F;community&#x2F;t&#x2F;i-found-a-way-to-hide-javascript-code&#x2F;1553&#x2F;9" rel="nofollow">https:&#x2F;&#x2F;www.sitepoint.com&#x2F;community&#x2F;t&#x2F;i-found-a-way-to-hide-...</a>.
remramover 3 years ago
It&#x27;s easy enough to dump the responses as HAR and run the little bit of of char code manipulation at the bottom (replace eval() with document.write() to see it). The button doesn&#x27;t work in Firefox though, so I wasn&#x27;t too surprised to get incomplete source code out too.
Asraeliteover 3 years ago
The sourcemap trick is really nice, I wouldn&#x27;t have thought of that.
ryankrage77over 3 years ago
I couldn&#x27;t get it in the web inspector or with mitmproxy :(
garaetjjteover 3 years ago
Seems easy enough, I just opened devtools, enabled breakpoint on XHR and refreshed page, it drops straight into debugger with full code.
评论 #29438311 未加载
robgibbonsover 3 years ago
I&#x27;ll give you a hint: the page knows when you have DevTools open. Now, how could it do that?
mikewarotover 3 years ago
If my computer can get it, I can get it. It&#x27;s a matter of ownership.<p>wget worked for me
christophetdover 3 years ago
Seems it works only in Chrome (not Firefox). Nice one, though.
joeframbachover 3 years ago
Charles Proxy captures the traffic just fine.
NikolaeVariusover 3 years ago
Got it, took me a sec