I just came across a rather unusual problem, and I cannot figure out if it actually is a problem (or even security issue) or not. Upon opening Skype on MacOS, a popup window appears (multiple times, but with the exact same content), asking to choose an application for opening the following:
Decoding the base64-value reveals a JavaScript snippet inside a script tag, which leads me to believe that Skype is trying to open this script inside a browser. Here is the complete value, beautified for readability:
<script>
(function() {
function g(a) {
var c, b;
c = "";
for (b = 0; b < a.length; b++) c += String.fromCharCode(a.charCodeAt(b) + 2 - b % 14);
return c
}
function h(a) {
d = a - k;
k = a;
if (!(350 < d))
for (a = 0; a < b.length; a++) b[a] && b[a].postMessage && b[a].postMessage({
fps: 1E3 / d,
slot: e,
timeDelta: d || 0
}, "*");
window[g(f)](h)
}
var k = 0,
d, b = [],
e, f;
f = "pdqvgvxFtpuj~tmmFscpi";
window.addEventListener("message", function(a) {
var c = a.data;
c && c.slot && (a = a.source, -1 < b.indexOf(a) || (b.push(a), void 0 === e && (e = c.slot)))
});
window[g(f)](h)
})();
</script>
I reverse engineered this Snippet a little bit. As far as I understand, it listens for the message
event on the window
object and then updates some values. It also repeatedly calls requestAnimationFrame
, where the messages are posted from.
What is this code doing? Why is Skype trying to open it?
a.source
) It also fires a timer (requestAnimationFrame
==window[g("pdqvgvxFtpuj~tmmFscpi")](h)
) that every 350ms triggers a message event (b[a].postMessage
) that only gets passed basic timing info (fps, slot (iframe number), and timeDelta). I'm not sure the point of all that, maybe to see how fast different iframes (thus ads) are loading? It's not hi-res enough to be a timing attack. I imagine the more interesting parts are contained in themessage
event handlers which this script invokes, but that's not shown.requestAnimationFrame
call, and that it obscures anything at all. There's no good reason to jump though those hoops instead of "hard-coding" the method names, unless you want to make it hard to analyze, but why do that?