1

There are several posts with similar question as mine but none seem to answer my issue. I am currently working to reverse engineer a site where a JavaScript file is being loaded in under sources. For example purposes I will refer to it as foo.js. This script is generating a cookie that I need. I will refer to it as bar. foo.js is actively generating a new bar cookie everytime I refresh the cookies tab under Application in Chrome dev tools meaning its being generating at least every second by foo.js.

The catch is that foo.js is heavily obfuscated with enterprise security where I cannot do a simple CTRL + F and look for document.cookie. But that isn't really relevant anyways. What I'm wondering is, surley a function is being ran to generate this since it's not hardcoded so how can I see what functions are being ran?

I have tried setting breakpoints in the code but there are over 15,000 lines of code so it's a bit inefficient. I have also tried pausing script execution and looking at the Call Stack and there are functions being executed from foo.js but it's very vague on what these functions are returning. Additionally I don't think the functions I'm seeing are the correct one's because they only show up when I visit certain pages whereas the bar cookie is being generated constantly no matter what page I'm on.

Is there any clear way to simply see what functions are being executed in the background and what they're returning? Specifically involving cookies. I feel like this should be a simple feature but I can seem to figure it out.

Joe
  • 85
  • 12
  • 2
    You can set a breakpoint at page start and run debug(Object.getOwnPropertyDescriptor(Document.prototype, 'cookie').set) – wOxxOm Sep 13 '20 at 05:14
  • My apologies for responding this late, but I've just got the time to try this now. When I Put this in console I just get `undefined`. What would that mean? Thanks in advanced. @wOxxOm – Joe Sep 18 '20 at 02:29
  • 1
    This command doesn't return anything so `undefined` is the correct result. The point is that it'll trigger debugger if there's any code that sets document.cookie. The important thing is to do it on page start, not after it loaded. – wOxxOm Sep 18 '20 at 04:14
  • Thank you very much, I got it working :) @wOxxOm – Joe Sep 18 '20 at 04:37

0 Answers0