PayPal Express – no shipping options?

I was working on the ‘official’ PayPal Express release for osCommerce:

https://cms.paypal.com/cms_content/GB/en_GB/files/developer/osc_PayPal_v177.zip

Installation was fine (other than the recurring payments bits which I did not install) but, when I was testing it on the PayPal Sandbox I found that I was being presented with no shipping fee at checkout_confirmation – just the single character ‘r’

Tracking down the reason took awhiles but here it is – in the file ext/modules/payment/paypal/express.php find the following at around line 300:

// select cheapest shipping method
$shipping = $shipping_modules->cheapest();
$shipping = $shipping['id'];

Change this by commenting out the last line

 // select cheapest shipping method
$shipping = $shipping_modules->cheapest();
//$shipping = $shipping['id'];

Rogue files #2

Came across a couple of ‘extra’ files added to a client’s osC installation by XSS

ext/modules/payment/paypal/verify_ipn.php

This one contained a nice little virus package and is not to be confused with the genuine osC file that you may have on your site :

ext/modules/payment/paypal_ipn/verify_ipn.php

On the same site there was a file /images/ind.php that had been dropped in there – there should be nothing in the /images/ folder for osC other than images and possible a .htaccess file – worth having a look.

The images folder is easy for a hacker to drop a file into as the permissions on there may be set to 777 – you can try changing that to 755 which works on some hosting servers – but on others it seems to be that 777 is needed.

If you are set to 777 and a script file is placed into the images folder then you could try and stop it from running by using the .htaccess script listed here – like one contributor says on there it won’t stop the hack taking place but at least it will stop the blasted file from running.

FancyBox for osC and IE8 – bug & solution.

For years I have been implementing a multiple image contribution for osCommerce which involved a lot of hacking around with the admin/categories.php file the – venerable Multi Pics contribution.

Today I tried something new which I chanced upon – Simple Multi Image Add-on (Un-Limited) with FancyBox Popups

Combined with oscThumbs this proved to be  fairly easy to install and setup and gave pretty good results which, with a little tweaking can give you some pretty decent image layouts on your product_info.php page. Then I looked at IE8 and it was not happy – no fancy popup :-(

I tried debugging the javascript; using a different download of Fancybox; IE8 compatability mode; standing on my head and then waded through 40 plus pages on the osC forums until I found the solution  here posted by Mr Longhorn 1999.

So if you comment out lines 183-186 and 201-204 in images/js/jquery.fancybox.js  and remove that particular meta tag from product_info.php, the product pages in  IE8 should look alright, just like they do in FF.  

In the js.query.fancybox.js files the two blocks of code you are looking for are:

at line 183


if (isIE) {
 $("#fancy_content")[0].style.removeExpression("height");
 $("#fancy_content")[0].style.removeExpression("width");
 }

and at line 201:


if (isIElt9) {
 $("#fancy_content")[0].style.setExpression('height',    '(this.parentNode.clientHeight - 20)');
 $("#fancy_content")[0].style.setExpression('width',        '(this.parentNode.clientWidth - 20)');
 }

The meta tag he mentions is this:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

which the contribution asks you to add to your product_info.php (or sts_template in my case) immediately after the <head> tag.

The only other thing to be aware of is that you must have the correct doctype in your code – but that is well documented in the download.

‘edoced_46esab’ – whassat?

Another site flagged up by Google as being ‘dirty’ – on being asked to look through the files by the owner I could find only two ‘naughty’ files and  no database changes.

The file with the malware was (again) called ‘google1234568.php’ (where 1234568 is a random mix of characters) and was in the root folder. This is a non-standard osC file and the filename is an attempt to mimic a standard Google Web Tools verification file which will be called google1234568.html

The malware code in the file was encoded thus:

<?php $D=strrev('edoced_46esab');$s=gzinflate($D.....yadda....yadda...

Decompiling the code revealed a pile of php functions designed to search out various files (including windows, *nix and Mac password files; http.conf files, config.php etc etc) on the local disc and copy them. Sneakily the very first couple of lines were designed to return a 404 error to a number of bots including Google in an attempt to stop the bots from finding the malware code that followed.
This fake file still needs to be called from somewhere else the chances of it being visited by your average punter is virtually nil – running a file comp found that the only other suspicious file was cookie_usage.php and that one had been entirely substituted with code to call the fake google file.

The site was cleaned up and resubmitted to Google who cleared the malware flag.

You must secure an osC site properly – check out v2.3. Also try these:

osC Sitemonitor by Jack_mcs forum discussion here

osC Security Forum

ANZ Egate not displaying in the front end

If you install the ANZ Egate payment module that uses MIGS ( get it here ) and, after activation it in the admin, you may be puzzled to find that it does not display in the front end. You then spend ages bug hunting. I did.

The front end will not display unless you insert both a MIGS Merchant ID and MIGS Access Code in the admin page – both these can be any dummy numbers that you like but, without those two fields filled in the module will not display in checkout_payment.php

Discussed here.

Rogue files

Whilst running a file comparison between a good, local copy of a hacked osC site I found a number of poor,little orphan files on the server that, when examined, were full of nasty, ‘orrible code. Here’s a list of the little darlings which may help you:

In catalog folder

google ********.php (where ******* are random characters)
cookie_setup.php
jsys.php                 (a genuine file of this name may appear with Joomla)
reader.php

catalog/images

****.php – there should be no php files in the images folder

catalog/includes/classes

nusoap.php

In the admin folder (or whatever you have renamed it to. You have renamed it haven’t you?) These files are standard php/js files that have been placed on the server to assist the hacker in uploading/changing other files.

JsHttpRequest.php
utils.js

admin/incudes/classes/

nusoap.php

Also a .htaccess file has appeared in lots of directories where, previously, there was none. This new htaccess file is set to prevent directory browsing and just contains the line

Options All -Indexes

Changed Files

catalog/cookie_useage.php

catalog/includes/header.php  (base 64 code added after final ?> )

catalog/includes/languages/xxxxxx/cookie_useage.php