Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Obfuscated script (likely malware)

Obfuscated script (likely malware)

Scheduled Pinned Locked Moved JavaScript
comhardwaretoolsperformancequestion
13 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Bernhard Hiller

    What does following script do:

    (function() { var b=window,f="chrome",g="jstiming",k="tick";(function(){function d(a){this.t={};this.tick=function(a,d,c){var e=void 0!=c?c:(new Date).getTime();this.t[a]=[e,d];if(void 0==c)try{b.console.timeStamp("CSI/"+a)}catch(h){}};this[k]("start",null,a)}var a;b.performance&&(a=b.performance.timing);var n=a?new d(a.responseStart):new d;b.jstiming={Timer:d,load:n};if(a){var c=a.navigationStart,h=a.responseStart;0<c&&h>=c&&(b[g].srt=h-c)}if(a){var e=b[g].load;0<c&&h>=c&&(e[k]("_wtsrt",void 0,c),e[k]("wtsrt_","_wtsrt",h),e[k]("tbsd_","wtsrt_"))}try{a=null,
    b[f]&&b[f].csi&&(a=Math.floor(b[f].csi().pageT),e&&0<c&&(e[k]("_tbnd",void 0,b[f].csi().startE),e[k]("tbnd_","_tbnd",c))),null==a&&b.gtbExternal&&(a=b.gtbExternal.pageT()),null==a&&b.external&&(a=b.external.pageT,e&&0<c&&(e[k]("_tbnd",void 0,b.external.startE),e[k]("tbnd_","_tbnd",c))),a&&(b[g].pt=a)}catch(p){}})();b.tickAboveFold=function(d){var a=0;if(d.offsetParent){do a+=d.offsetTop;while(d=d.offsetParent)}d=a;750>=d&&b[g].load[k]("aft")};var l=!1;function m(){l||(l=!0,b[g].load[k]("firstScrollTime"))}b.addEventListener?b.addEventListener("scroll",m,!1):b.attachEvent("onscroll",m);
    })();

    I found it embedded in a page which looks harmless... [Edit]I guess it is the same type of hack which I experienced 1.5 years agon on my web site, but the hacker added some more obfuscation now. See Analysing an obfuscated malware script[^].[/Edit]

    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu Peter
    wrote on last edited by
    #2

    It's not obfuscated, but minified and it looks like a timing function, based on Google's library...

    I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

    B 1 Reply Last reply
    0
    • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

      It's not obfuscated, but minified and it looks like a timing function, based on Google's library...

      I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #3

      Thanks for your analysis. I hardly ever use JavaScript, so I rely mainly on context and experience. "minify" and "obfuscate" cause the same impression...

      N 1 Reply Last reply
      0
      • B Bernhard Hiller

        What does following script do:

        (function() { var b=window,f="chrome",g="jstiming",k="tick";(function(){function d(a){this.t={};this.tick=function(a,d,c){var e=void 0!=c?c:(new Date).getTime();this.t[a]=[e,d];if(void 0==c)try{b.console.timeStamp("CSI/"+a)}catch(h){}};this[k]("start",null,a)}var a;b.performance&&(a=b.performance.timing);var n=a?new d(a.responseStart):new d;b.jstiming={Timer:d,load:n};if(a){var c=a.navigationStart,h=a.responseStart;0<c&&h>=c&&(b[g].srt=h-c)}if(a){var e=b[g].load;0<c&&h>=c&&(e[k]("_wtsrt",void 0,c),e[k]("wtsrt_","_wtsrt",h),e[k]("tbsd_","wtsrt_"))}try{a=null,
        b[f]&&b[f].csi&&(a=Math.floor(b[f].csi().pageT),e&&0<c&&(e[k]("_tbnd",void 0,b[f].csi().startE),e[k]("tbnd_","_tbnd",c))),null==a&&b.gtbExternal&&(a=b.gtbExternal.pageT()),null==a&&b.external&&(a=b.external.pageT,e&&0<c&&(e[k]("_tbnd",void 0,b.external.startE),e[k]("tbnd_","_tbnd",c))),a&&(b[g].pt=a)}catch(p){}})();b.tickAboveFold=function(d){var a=0;if(d.offsetParent){do a+=d.offsetTop;while(d=d.offsetParent)}d=a;750>=d&&b[g].load[k]("aft")};var l=!1;function m(){l||(l=!0,b[g].load[k]("firstScrollTime"))}b.addEventListener?b.addEventListener("scroll",m,!1):b.attachEvent("onscroll",m);
        })();

        I found it embedded in a page which looks harmless... [Edit]I guess it is the same type of hack which I experienced 1.5 years agon on my web site, but the hacker added some more obfuscation now. See Analysing an obfuscated malware script[^].[/Edit]

        D Offline
        D Offline
        DragonHeart335
        wrote on last edited by
        #4

        Don't know a lot about Javascript, but there seem to be multiple syntax errors in your script.

        Kornfeld Eliyahu PeterK U 2 Replies Last reply
        0
        • D DragonHeart335

          Don't know a lot about Javascript, but there seem to be multiple syntax errors in your script.

          Kornfeld Eliyahu PeterK Offline
          Kornfeld Eliyahu PeterK Offline
          Kornfeld Eliyahu Peter
          wrote on last edited by
          #5

          Where?

          I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

          "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

          D 1 Reply Last reply
          0
          • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

            Where?

            I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

            D Offline
            D Offline
            DragonHeart335
            wrote on last edited by
            #6

            (function() -- Isn't the leading ( a syntax error in Javascript? It is found several times in the script above.

            Kornfeld Eliyahu PeterK 1 Reply Last reply
            0
            • D DragonHeart335

              (function() -- Isn't the leading ( a syntax error in Javascript? It is found several times in the script above.

              Kornfeld Eliyahu PeterK Offline
              Kornfeld Eliyahu PeterK Offline
              Kornfeld Eliyahu Peter
              wrote on last edited by
              #7

              It's perfectly normal - it called closure... https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures[^]

              I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

              "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

              D 1 Reply Last reply
              0
              • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                It's perfectly normal - it called closure... https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Closures[^]

                I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

                D Offline
                D Offline
                DragonHeart335
                wrote on last edited by
                #8

                Ok, found it. I was looking for the CLOSING parenthesis. When I first loaded it into Notepad++ I didn't see it. Thx for the link.

                1 Reply Last reply
                0
                • B Bernhard Hiller

                  Thanks for your analysis. I hardly ever use JavaScript, so I rely mainly on context and experience. "minify" and "obfuscate" cause the same impression...

                  N Offline
                  N Offline
                  Nicholas Marty
                  wrote on last edited by
                  #9

                  minifying is just to decrease the size of the script and thus decreasing the time needed for loading it from the server obfuscating the code is done to protect the code to some degree from beeing copied by others. You can't compile javascript into a binary form that prevents doing so (you can't compile any .Net applications in that regard neither) so in those cases obfuscation makes it harder to understand the code. A small sample (consider this as a piece of pseudo code)

                  function foo() {
                  // do foo
                  var counter = 0;
                  bar(counter);
                  }
                  function bar(var myParam) {
                  // do something with myParam
                  var somethingElse = myParam;
                  }

                  and obfuscate it to

                  function a() {
                  var b=0;
                  a(b);
                  }
                  function a(var b) {
                  var c=b;
                  }

                  you don't really know what those function really do without having the full context of it, thus making it a lot harder to just copy a function out of the script "stealing" someone else's hard work. So nothing shady about those (of course you could assume that malicious scripts will usually be obfuscated and minified to prevent user from easily detect what they are doing)

                  B 1 Reply Last reply
                  0
                  • N Nicholas Marty

                    minifying is just to decrease the size of the script and thus decreasing the time needed for loading it from the server obfuscating the code is done to protect the code to some degree from beeing copied by others. You can't compile javascript into a binary form that prevents doing so (you can't compile any .Net applications in that regard neither) so in those cases obfuscation makes it harder to understand the code. A small sample (consider this as a piece of pseudo code)

                    function foo() {
                    // do foo
                    var counter = 0;
                    bar(counter);
                    }
                    function bar(var myParam) {
                    // do something with myParam
                    var somethingElse = myParam;
                    }

                    and obfuscate it to

                    function a() {
                    var b=0;
                    a(b);
                    }
                    function a(var b) {
                    var c=b;
                    }

                    you don't really know what those function really do without having the full context of it, thus making it a lot harder to just copy a function out of the script "stealing" someone else's hard work. So nothing shady about those (of course you could assume that malicious scripts will usually be obfuscated and minified to prevent user from easily detect what they are doing)

                    B Offline
                    B Offline
                    Bernhard Hiller
                    wrote on last edited by
                    #10

                    Thanks for this explanation. It was the context (faked entry in a log file) paired with past experience and the unreadability of that script which made me assume malware. Though minifying scripts may be legitimate to decrease the still increasing enormous volumes of JavaScripts sent over the network with still decreasing "payload" of actual content, it makes distinguishing those scripts from intentiously obfuscated malware scripts extremely hard - thus actually causing security issues.

                    1 Reply Last reply
                    0
                    • B Bernhard Hiller

                      What does following script do:

                      (function() { var b=window,f="chrome",g="jstiming",k="tick";(function(){function d(a){this.t={};this.tick=function(a,d,c){var e=void 0!=c?c:(new Date).getTime();this.t[a]=[e,d];if(void 0==c)try{b.console.timeStamp("CSI/"+a)}catch(h){}};this[k]("start",null,a)}var a;b.performance&&(a=b.performance.timing);var n=a?new d(a.responseStart):new d;b.jstiming={Timer:d,load:n};if(a){var c=a.navigationStart,h=a.responseStart;0<c&&h>=c&&(b[g].srt=h-c)}if(a){var e=b[g].load;0<c&&h>=c&&(e[k]("_wtsrt",void 0,c),e[k]("wtsrt_","_wtsrt",h),e[k]("tbsd_","wtsrt_"))}try{a=null,
                      b[f]&&b[f].csi&&(a=Math.floor(b[f].csi().pageT),e&&0<c&&(e[k]("_tbnd",void 0,b[f].csi().startE),e[k]("tbnd_","_tbnd",c))),null==a&&b.gtbExternal&&(a=b.gtbExternal.pageT()),null==a&&b.external&&(a=b.external.pageT,e&&0<c&&(e[k]("_tbnd",void 0,b.external.startE),e[k]("tbnd_","_tbnd",c))),a&&(b[g].pt=a)}catch(p){}})();b.tickAboveFold=function(d){var a=0;if(d.offsetParent){do a+=d.offsetTop;while(d=d.offsetParent)}d=a;750>=d&&b[g].load[k]("aft")};var l=!1;function m(){l||(l=!0,b[g].load[k]("firstScrollTime"))}b.addEventListener?b.addEventListener("scroll",m,!1):b.attachEvent("onscroll",m);
                      })();

                      I found it embedded in a page which looks harmless... [Edit]I guess it is the same type of hack which I experienced 1.5 years agon on my web site, but the hacker added some more obfuscation now. See Analysing an obfuscated malware script[^].[/Edit]

                      J Offline
                      J Offline
                      jkirkerx
                      wrote on last edited by
                      #11

                      Just for the hell of it, I ran it through the beautifier to get a better look at it. http://jsbeautifier.org/[^]

                      (function () {
                      var b = window,
                      f = "chrome",
                      g = "jstiming",
                      k = "tick";
                      (function () {
                      function d(a) {
                      this.t = {};
                      this.tick = function (a, d, c) {
                      var e = void 0 != c ? c : (new Date).getTime();
                      this.t[a] = [e, d];
                      if (void 0 == c) try {
                      b.console.timeStamp("CSI/" + a)
                      } catch (h) {}
                      };
                      this[k]("start", null, a)
                      }
                      var a;
                      b.performance && (a = b.performance.timing);
                      var n = a ? new d(a.responseStart) : new d;
                      b.jstiming = {
                      Timer: d,
                      load: n
                      };
                      if (a) {
                      var c = a.navigationStart,
                      h = a.responseStart;
                      0 < c && h >= c && (b[g].srt = h - c)
                      }
                      if (a) {
                      var e = b[g].load;
                      0 < c && h >= c && (e[k]("_wtsrt", void 0, c), e[k]("wtsrt_", "_wtsrt", h), e[k]("tbsd_", "wtsrt_"))
                      }
                      try {
                      a = null,
                      b[f] && b[f].csi && (a = Math.floor(b[f].csi().pageT), e && 0 < c && (e[k]("_tbnd", void 0, b[f].csi().startE), e[k]("tbnd_", "_tbnd", c))), null == a && b.gtbExternal && (a = b.gtbExternal.pageT()), null == a && b.external && (a = b.external.pageT, e && 0 < c && (e[k]("_tbnd", void 0, b.external.startE), e[k]("tbnd_", "_tbnd", c))), a && (b[g].pt = a)
                      } catch (p) {}
                      })();
                      b.tickAboveFold = function (d) {
                      var a = 0;
                      if (d.offsetParent) {
                      do a += d.offsetTop; while (d = d.offsetParent)
                      }
                      d = a;
                      750 >= d && b[g].load[k]("aft")
                      };
                      var l = !1;

                      function m() {
                          l || (l = !0, b\[g\].load\[k\]("firstScrollTime"))
                      }
                      b.addEventListener ? b.addEventListener("scroll", m, !1) : b.attachEvent("onscroll", m);
                      

                      })();

                      B 1 Reply Last reply
                      0
                      • J jkirkerx

                        Just for the hell of it, I ran it through the beautifier to get a better look at it. http://jsbeautifier.org/[^]

                        (function () {
                        var b = window,
                        f = "chrome",
                        g = "jstiming",
                        k = "tick";
                        (function () {
                        function d(a) {
                        this.t = {};
                        this.tick = function (a, d, c) {
                        var e = void 0 != c ? c : (new Date).getTime();
                        this.t[a] = [e, d];
                        if (void 0 == c) try {
                        b.console.timeStamp("CSI/" + a)
                        } catch (h) {}
                        };
                        this[k]("start", null, a)
                        }
                        var a;
                        b.performance && (a = b.performance.timing);
                        var n = a ? new d(a.responseStart) : new d;
                        b.jstiming = {
                        Timer: d,
                        load: n
                        };
                        if (a) {
                        var c = a.navigationStart,
                        h = a.responseStart;
                        0 < c && h >= c && (b[g].srt = h - c)
                        }
                        if (a) {
                        var e = b[g].load;
                        0 < c && h >= c && (e[k]("_wtsrt", void 0, c), e[k]("wtsrt_", "_wtsrt", h), e[k]("tbsd_", "wtsrt_"))
                        }
                        try {
                        a = null,
                        b[f] && b[f].csi && (a = Math.floor(b[f].csi().pageT), e && 0 < c && (e[k]("_tbnd", void 0, b[f].csi().startE), e[k]("tbnd_", "_tbnd", c))), null == a && b.gtbExternal && (a = b.gtbExternal.pageT()), null == a && b.external && (a = b.external.pageT, e && 0 < c && (e[k]("_tbnd", void 0, b.external.startE), e[k]("tbnd_", "_tbnd", c))), a && (b[g].pt = a)
                        } catch (p) {}
                        })();
                        b.tickAboveFold = function (d) {
                        var a = 0;
                        if (d.offsetParent) {
                        do a += d.offsetTop; while (d = d.offsetParent)
                        }
                        d = a;
                        750 >= d && b[g].load[k]("aft")
                        };
                        var l = !1;

                        function m() {
                            l || (l = !0, b\[g\].load\[k\]("firstScrollTime"))
                        }
                        b.addEventListener ? b.addEventListener("scroll", m, !1) : b.attachEvent("onscroll", m);
                        

                        })();

                        B Offline
                        B Offline
                        Bernhard Hiller
                        wrote on last edited by
                        #12

                        Thanks for that link.

                        1 Reply Last reply
                        0
                        • D DragonHeart335

                          Don't know a lot about Javascript, but there seem to be multiple syntax errors in your script.

                          U Offline
                          U Offline
                          User 11056480
                          wrote on last edited by
                          #13

                          malwares suck !! my computer has crashed twice becoz of it !! ask someone like me who knows what de pain is !! CLT20 2014
                          CLT20 2014 Live
                          CLT20 2014 live streaming
                          CLT20 2014 matches
                          CLT20 2014 Teams
                          CLT20 2014 Highlights

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups