Get the book

Go Back   Zen Cart Support > News and Announcements > Zen Cart Release Announcements

Zen Cart Release Announcements Watch this forum for new releases and other important announcements.
Click here to subscribe to these announcements.

Closed Thread
 
Thread Tools Display Modes
Old 28th June 2009, 12:27 AM   #1
DrByte
Sensei
 
DrByte's Avatar
 
Join Date: Jan 2004
Location: Ontario, Canada
Posts: 44,123
Default PCI Scans - patch to handle low-priority warnings on search screen causing scan fail

There are some reports of sites failing PCI scans due to an error message that can appear on the search screen if someone attempts to do a SQL injection attack. While the attack fails, an error message appears which, to the purists, discloses the name of the database table and thus gets flagged as a problem. While it's a minor issue and poses no actual direct vulnerability, the PCI scan will fail.

To fix this in Zen Cart v1.3.0 through v1.3.8a, simply do the following:

Create a NEW file, call it: /includes/extra_configures/pci_patch_v13x_search.php
And insert only the following code into that file before saving and uploading to your server:
Code:
<?php
if (isset($_GET['keyword']) && $_GET['keyword'] != '')
{
  $count =  substr_count($_GET['keyword'], '"');
  if ($count == 1)
  {
    if(substr(stripslashes(trim($_GET['keyword'])), 0, 1) == '"')
    {
      $_GET['keyword'] .= '"';
    }
  }
  $_GET['keyword'] = stripslashes($_GET['keyword']);
}

if (isset($_GET['sort']) && strlen($_GET['sort']) > 3) {
  $_GET['sort'] = substr($_GET['sort'], 0, 3);
}
Zen Cart versions 1.2.x and older are reminded that they need to upgrade. This patch will not work for them.




And for those of you who wonder, the closing ?> tag is INTENTIONALLY left off of the above code snippet. See here for why: http://tutorials.zen-cart.com/index.php?article=313

Last edited by DrByte; 19th November 2009 at 09:35 PM. Reason: added the filter for $_GET['sort']
DrByte is offline  
Old 19th November 2009, 09:36 PM   #2
DrByte
Sensei
 
DrByte's Avatar
 
Join Date: Jan 2004
Location: Ontario, Canada
Posts: 44,123
Default Re: PCI Scans - patch to handle low-priority warnings on search screen causing scan f

Another PCI flag could be raised if long strings are used for sort parameters.
Again, while the so-called "attack" attempt will fail, an error message will appear, causing a PCI scan to raise a red flag.

Fixing this matter involves simply using the revised code posted above, as edited today.
__________________
Zen Cart - putting the dream of business ownership within reach of anyone!
DrByte is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
search results shows blank screen Graphic Content General Questions 1 22nd December 2008 06:03 PM
Attributes causing CC orders to fail kell61 Setting Up Categories, Products, Attributes 12 20th November 2008 04:41 AM


All times are GMT +1. The time now is 07:02 PM.

Learn tips, tricks & secrets for your Zen Cart™
Sign up for our FREE Newsletter

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content and Graphics Copyright (c) 2006, 2007, 2008, 2009, 2010 Zen Ventures, LLC - all rights reserved
Get Zen Cart E-Commerce Shopping Cart at SourceForge.net. Fast, secure and Free Open Source software downloads