If this is your first visit, check our documentation. To post, register or login.
Forums / Fraud Prevention / Preventing Credit Card Slamming

Preventing Credit Card Slamming

Started by damonp on 25 Jun 2007, 6:44 PM · Views: 4,517

Results 1 to 20 of 30
25 Jun 2007, 6:44 PM
#1
damonp avatar

damonp

New Zenner

Join Date:
Mar 2004
Posts:
54
Plugin Contributions:
0

Preventing Credit Card Slamming

The issue has been discussed before:
http://www.zen-cart.com/forum/showthread.php?t=52483&page=2#17

Through some trial and error we have come up with several code changes that are working well in our test cases.

The first being how to logout a customer automatically after X failed payment attempts with this snippet in modules/checkout_process.php:

if(! isset($_SESSION['payment_attempt'])) $_SESSION['payment_attempt'] = 0;
$_SESSION['payment_attempt']++;

if($_SESSION['payment_attempt'] > 6)   { // change 6 to change how many attempts to allow before auto logout
   // destroy session to log customer out
   zen_session_destroy();
   // redirect to timeout page or create new page to redirect to
   zen_redirect(zen_href_link(FILENAME_TIME_OUT, '', 'SSL'));
}

Complete details on using this snippet may be found at:
http://damonparker.org/blog/2007/06/22/zencart-hack-logout-customer-automatically-after-x-failed-payment-attempts/

cheers

damonparker.org
freelance web app dev
ZenCart Sites: pimpcostumes.com | platinumcostumes.com | costumeshoes.com

25 Jun 2007, 9:19 PM
#2
dogtags avatar

dogtags

Totally Zenned

Join Date:
Nov 2003
Posts:
876
Plugin Contributions:
1

Re: Preventing Credit Card Slamming

Interesting...

9 Nov 2007, 5:09 AM
#3
rajeev83 avatar

rajeev83

Zen Follower

Join Date:
Sep 2006
Posts:
127
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

Hi
just wanted to know is somebody using the above technique

read the faq and tutorials and they will help u solve little problems
www.goshoppinglive.com

25 Jan 2008, 2:48 PM
#5
ksoup avatar

ksoup

Zen Follower

Join Date:
Jan 2004
Posts:
413
Plugin Contributions:
1

Re: Preventing Credit Card Slamming

I added the code and tried testing it out... I wasn't logged out after 6 bad attempts. We are on cart 1.3.7. Any advice?

12 Nov 2008, 6:21 PM
#6
enchantedneedle avatar

enchantedneedle

New Zenner

Join Date:
Jan 2008
Posts:
74
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

ksoup:

I added the code and tried testing it out... I wasn't logged out after 6 bad attempts. We are on cart 1.3.7. Any advice?
Yeah, I put it on my site too and still was able to try about 10 times and gave up. It did not log me out. I really really need this right now. I'm under attack as I type.

Tammy
https://www.EnchantedCostumes.com
Zen Cart 1.3.9h

12 Nov 2008, 9:29 PM
#7
damonp avatar

damonp

New Zenner

Join Date:
Mar 2004
Posts:
54
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

This was originally written for a ZenCart 1.2 site. I'm in the process of upgrading to latest and greatest. I'll post back here what changes I find.

damonparker.org
freelance web app dev
ZenCart Sites: pimpcostumes.com | platinumcostumes.com | costumeshoes.com

12 Nov 2008, 10:25 PM
#8
drbyte avatar

drbyte

Sensei

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

Re: Preventing Credit Card Slamming

FWIW the upcoming v2.0 uses a similar technique for preventing credit card slamming attempts.

.
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.

1 Dec 2009, 9:04 PM
#9
patternman avatar

patternman

New Zenner

Join Date:
Jul 2008
Posts:
63
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

It has been quite a while since there has been any input about this modification to the code. I am very interested in using it, but the previous responses have not had a good success rate.

Does anybody know if this code is working properly with the latest version of Zen Cart? I'd prefer not to wait for Zencart 2.0.

Thank you.

2 Dec 2009, 8:04 PM
#10
damonp avatar

damonp

New Zenner

Join Date:
Mar 2004
Posts:
54
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

I took a look at the current code 1.3.8a and the code changes below should work.

The file is includes/modules/checkout_process.php

BEFORE:

// if the customer is not logged on, redirect them to the time out page
  if (!$_SESSION['customer_id']) {
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));
  } else {
    // validate customer
    if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
      $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING));
      zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
    }
  }

// confirm where link came from
if (!strstr($_SERVER['HTTP_REFERER'], FILENAME_CHECKOUT_CONFIRMATION)) {
  //    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT,'','SSL'));
}

AFTER:

// if the customer is not logged on, redirect them to the time out page
  if (!$_SESSION['customer_id']) {
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));
  } else {
    // validate customer
    if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
      $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING));
      zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
    }
  }

  // BEGIN CC SLAM PREVENTION
  if(! isset($_SESSION['payment_attempt']))	$_SESSION['payment_attempt'] = 0;
  $_SESSION['payment_attempt']++;
	
  if($_SESSION['payment_attempt'] > 6)	{
	zen_session_destroy();
	zen_redirect(zen_href_link(FILENAME_TIME_OUT));
  }
  // END CC SLAM PREVENTION

// confirm where link came from
if (!strstr($_SERVER['HTTP_REFERER'], FILENAME_CHECKOUT_CONFIRMATION)) {
  //    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT,'','SSL'));
}

This should auto-logout a user after six unsuccessful payment attempts. Adjust the '> 6' portion to set the number of tries before logout occurs.

This is code is untested in latest version but pretty simple to implement and test. Anyone running latest and greatest willing to try it out, let me know.

Improper use of this code could prevent anyone from checking out. The two things that will save you when trying this out are:

MAKE A BACKUP
FULLY TEST BEFORE CALLING IT COMPLETE

damonparker.org
freelance web app dev
ZenCart Sites: pimpcostumes.com | platinumcostumes.com | costumeshoes.com

2 Dec 2009, 10:04 PM
#11
patternman avatar

patternman

New Zenner

Join Date:
Jul 2008
Posts:
63
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

Thank you very much for the quick attention.
I will go ahead and try it out this week and post back with the results. :smile:

18 Feb 2010, 8:46 PM
#12
patternman avatar

patternman

New Zenner

Join Date:
Jul 2008
Posts:
63
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

Sorry for taking so long to get back to this.
We have not experienced any further slamming attempts, so this became a low-priority task for me.
I have inserted the code and tested it.
It works as it should. It logs the "customer" out after the desired number of declined attempts.

Someone really interested in testing more cards is free to do so, but this will make it a little more tedious. Hopefully, it is enough to deter those from using our site for such a purpose.

Thanks again for the help. :smile:
Jason A.

5 Jun 2010, 7:47 AM
#13
jasonhoward64 avatar

jasonhoward64

New Zenner

Join Date:
Jun 2009
Location:
Saskatchewan, CDN
Posts:
68
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

The code doesn't work at all. I was not logged out after trying many cc numbers. I'm running 1.3.8a. Any ideas?

5 Jun 2010, 5:22 PM
#14
damonp avatar

damonp

New Zenner

Join Date:
Mar 2004
Posts:
54
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

Originally posted in 2007 for v1.2 something. I don't currently have a 1.3.8 or more recent to test on. If someone has an install that I can get access to I'll look and update here for all.
Posted via Mobile Device

damonparker.org
freelance web app dev
ZenCart Sites: pimpcostumes.com | platinumcostumes.com | costumeshoes.com

5 Jun 2010, 10:48 PM
#15
jasonhoward64 avatar

jasonhoward64

New Zenner

Join Date:
Jun 2009
Location:
Saskatchewan, CDN
Posts:
68
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

The last post on the 1st page outlines code that is supposed to work on 1.3.8... I'm confused.

Thanks

6 Jun 2010, 4:13 AM
#17
jasonhoward64 avatar

jasonhoward64

New Zenner

Join Date:
Jun 2009
Location:
Saskatchewan, CDN
Posts:
68
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

damonp:

You said it wasn't working. I offered to take a look. Other than that I don't know.
Posted via Mobile Device

Oh, I was just confused because you said that it was for V1.2. I was thinking that you thought that I was trying to use that code that was developed for V1.2.

Do you see any problems in the code? I'd really appreciate if you could fix it.

Thanks!

31 Aug 2010, 12:22 AM
#18
abby0880 avatar

abby0880

New Zenner

Join Date:
Aug 2010
Posts:
2
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

damonp:

I took a look at the current code 1.3.8a and the code changes below should work.

The file is includes/modules/checkout_process.php

BEFORE:

// if the customer is not logged on, redirect them to the time out page
if (!$_SESSION['customer_id']) {
zen_redirect(zen_href_link(FILENAME_TIME_OUT));
} else {
// validate customer
if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
$_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING));
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
}

// confirm where link came from
if (!strstr($_SERVER['HTTP_REFERER'], FILENAME_CHECKOUT_CONFIRMATION)) {
// zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT,'','SSL'));
}

> 
> AFTER:
> ```php
// if the customer is not logged on, redirect them to the time out page
  if (!$_SESSION['customer_id']) {
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));
  } else {
    // validate customer
    if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
      $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING));
      zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
    }
  }

  // BEGIN CC SLAM PREVENTION
  if(! isset($_SESSION['payment_attempt']))	$_SESSION['payment_attempt'] = 0;
  $_SESSION['payment_attempt']++;
	
  if($_SESSION['payment_attempt'] > 6)	{
	zen_session_destroy();
	zen_redirect(zen_href_link(FILENAME_TIME_OUT));
  }
  // END CC SLAM PREVENTION

// confirm where link came from
if (!strstr($_SERVER['HTTP_REFERER'], FILENAME_CHECKOUT_CONFIRMATION)) {
  //    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT,'','SSL'));
}

This should auto-logout a user after six unsuccessful payment attempts. Adjust the '> 6' portion to set the number of tries before logout occurs.

This is code is untested in latest version but pretty simple to implement and test. Anyone running latest and greatest willing to try it out, let me know.

Improper use of this code could prevent anyone from checking out. The two things that will save you when trying this out are:

MAKE A BACKUP
FULLY TEST BEFORE CALLING IT COMPLETE

Has somebody tried this out already? I am not really that technical when it comes to this kind of issues so I am really hesitant trying it out.

31 Aug 2010, 3:46 AM
#19
drbyte avatar

drbyte

Sensei

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

Re: Preventing Credit Card Slamming

The feature is already built-in to v1.3.9

.
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.

2 Sep 2010, 2:44 AM
#20
abby0880 avatar

abby0880

New Zenner

Join Date:
Aug 2010
Posts:
2
Plugin Contributions:
0

Re: Preventing Credit Card Slamming

DrByte:

The feature is already built-in to v1.3.9

It figures. Thanks DrByte for shedding some light to this. online slots pokies