Special characters in billing info (customer name) breaks cc encryption

Project:Ubercart Contributions
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

Hey guys.

Today we got a report from a user who, when trying to Checkout, received this error after submitting the form.

"To protect our customers from identity theft, credit card details are erased when a browser refreshes on the checkout review page. Please enter your card details again and re-submit the form."
.. and would then spit them back to the checkout form.

When looking at the Watchdog logs, for "encryption" errors I found this.

Type: encryption
Date: Tuesday, July 15, 2008 - 1:39pm
User: ***
Location /cart/checkout
Referrer /cart/checkout

Message
Encryption failed.
Source string contains an invalid character (
Severity: error

It turns out this issue was caused by the user's last name, which had a special character in it: ö

I had him change his name to use just an "o", since our card system doesn't do a strict match of the cardholder name. His order went through fine after that.

I'm not sure what other fields would be affected by this bug but I'm sure the cardholder name isn't the only one. Anything that gets encrypted is likely to be susceptible.

Version: 
Ubercart 1.x-dev
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Special characters in billing info (customer name) breaks cc

Very interesting... sorry for the trouble. I wonder if I can use utf8_decode() to sanitize fields prior to encryption. Puzzled

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Special characters in billing info (customer name) break
Assigned to:Ryan» torgosPizza

For us I think it'd be a rare thing, but you never know when someone will use a character like that in their last name. And for European cart merchants especially, it'll affect them more, I'm sure. Smiling

If encoding or decoding to utf8 would work. I'm wondering how the pathauto module does it? I think it might actually use the same premise to take non-standard chars and convert them to their standard equivalent.

--
Help directly fund development: Donate via PayPal!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Special characters in billing info (customer name) b
Assigned to:torgosPizza» Ryan

Pathauto was the first module I thought of, too. Sticking out tongue I'll try to check it out and work that into the encryption class...

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: Re: Re: Re: Special characters in billing info (customer nam
Assigned to:Ryan» Al

Transliteration is the keyword, see install.txt. The complete i18n-ascii-full.txt has 470kb.
Would be nice if all the pathauto users who already configured i18n-ascii.txt could recycle it for cc encrytion.

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Re: Re: Special characters in billing info (customer
Assigned to:Al» torgosPizza

Heh.. we just had another person email us with this issue. I guess we have more Swedish customers than I thought! Any update on this? (No rush, really - just checking.)

--
Help directly fund development: Donate via PayPal!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Special characters in billing info (cust
Assigned to:torgosPizza» Ryan

I'm gonna need some help on this one... I'd love to have a simple solution for core, even if it just means stripping out illegitimate characters. Sticking out tongue There's a transliteration module available at http://drupal.org/project/transliteration that we can maybe hook into further. Anyone wanna take this on?

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Re: Re: Re: Re: Special characters in billing info (
Assigned to:Ryan» torgosPizza

As soon as I get some free time I can contribute. This week is Comic-Con, and we have a booth there, so this week was gone before it even started Smiling But it is something we need since we have international customers. I wonder how (if?) anyone in Germany or Sweden has approached or dealt with this issue?

The odd thing is Drupal itself, without that module, seems to have disagreed with the character as well. The name Björn (when used in a username) is created as Bj-rn. I will look into installing that module as a counter to that issue as well..

--
Help directly fund development: Donate via PayPal!

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Re: Re: Re: Re: Re: Special characters in billing in

Actually, I just got it to work.

- Installed Tranlisteration module.
- Went into uc_credit.module. Everywhere there was mention of check_plain($_POST['cc_owner']) I replaced it with check_plain(transliteration_get($_POST['cc_owner'])).

I was able to test this by creating a test order, and just editing the Order Details, Payment method (Credit Card).

Originally:
- Add a user "Test Test" with all card details. Saves fine.
- Edit details of Card Owner to say "Björn Test" and re-save.
- Reload order details, all of the Credit Card data is gone from the order.

After I edited the .module:
- Edit details of Card Owner to say "Björn Test" and saved.
- Reloaded order. Card Owner now shows as "Bjorn Test" (note the transliterated "o").
- All card data is visible in the order.

I think this would be enough to satisfy this issue? What do you think? The entire process only took a few minutes but I haven't done any thorough testing. Initial results are positive, though. My only concern is that this would add another module dependency. Or you could just add switches in, as per the README doc:

<?php
if (module_exists('transliteration')) {
 
$transliterated = transliteration_get($string);
}
?>

So maybe not a dependency per se, but a recommendation for any stores who might be selling outside of the US.

--
Help directly fund development: Donate via PayPal!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Quote:So maybe not a
Assigned to:torgosPizza» Ryan
Quote:

So maybe not a dependency per se, but a recommendation for any stores who might be selling outside of the US.

Yeah, I think I like this idea... I just have to remember to document it. Shocked

A lot of people won't even need to collect CC names, so for most people it's quite likely they'll never be attempting to encrypt unsupported characters anyways. Thanks for lending a hand!

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Quote:So maybe not a
Assigned to:Ryan» torgosPizza

When you say they "won't need to collect CC names" .. is that an option? I hadn't even thought to look - can I remove the Card Owner field? Will that field get replaced by the "Billing Information" names? Or can it just be removed without any issues? I'll look at our authorize.net settings and see if we're requiring a name on the cards. If that's the case then maybe I'll just do away with that field altogether...

--
Help directly fund development: Donate via PayPal!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Quote:So maybe not a
Assigned to:torgosPizza» Ryan

Yeah, it's totally an option in the CC settings. Our company uses CyberSource and I don't think we ever enter names. I'm honestly not even sure which of the payment modules accommodate the CC name and which just use the billing name. Puzzled

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Quote:So maybe not a
Assigned to:Ryan» torgosPizza

After consulting with our accounting department, we do need to keep the Card Owner field - so I think leveraging the Transliteration module would be a good idea. I honestly have never seen a store that did not ask for a separate Card Owner, or at least only asked for the Billing Address (no names) and then used the Card Owner field as the Billing information name.

So I think that leaving them as-is should be the way to go. If the Billing customer info isn't getting encrypted then there's no need to transliterate it; but any text strings that have the potential to break encryption should be.

--
Help directly fund development: Donate via PayPal!

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: Re: Quote:So maybe not a

I saw that this was updated to "fixed" - what did the solution end up being?

--
Help directly fund development: Donate via PayPal!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Quote:So maybe not a
Assigned to:torgosPizza» Ryan

Not sure.. cha0s made that change, but I think he might have just been rolling through the tracker cleaning up old issues. I'll ping him on this one.

boazr's picture
Offline
Joined: 06/15/2009
Juice: 9
Re: Re: Re: Re: Re: Re: Quote:So maybe not a
Assigned to:Ryan» boazr

This was not fixed in the ver i bzred yesterday.

Had to manually patch uc_credit.module with transliteration_get

zisser's picture
Offline
Joined: 11/15/2009
Juice: 4
What about other chars like hebrew or arabic?
Assigned to:boazr» zisser

I have the same issue and I'm not sure how or what to do here..
I'm localizing the cart to Hebrew and the card holder name must be in hebrew.

Does anyone here have an idea how to get past the warning msg?

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: What about other chars like hebrew or arabic?
Assigned to:zisser» TR

One of the fundamental flaws of the encryption scheme chosen by Ubercart is the fact that it is limited to only "all 95 printable characters from the ASCII character set EXCEPT single quote, double and backslash". In particular, it can't handle non-ASCII Latin characters, so ironically Ubercart can't even encrypt Übercart. And it certainly can't handle the entire Unicode set, even in UTF-8 form, so Hebrew or Arabic are not possible. The only real solution is to replace the flawed encryption scheme with a more robust and capable one.

<tr>.
idanarbel's picture
Offline
Joined: 08/01/2008
Juice: 115
Re: Re: What about other chars like hebrew or arabic?
Assigned to:TR» idanarbel

any sollution on this?

eclauset's picture
Offline
Joined: 09/18/2008
Juice: 25
#19
Category:» bug report
Assigned to:idanarbel» Guest

Just ran into this problem at my site as well, using Ubercart 5.x-1.9

dmsky's picture
Offline
Joined: 04/25/2011
Juice: 6
#20
Title:Special characters in billing info (customer name) breaks cc encryption» Re: Special characters in billing..SOLUTION
Assigned to:Guest» dmsky

i also had this problem, and found the culprit in the Payment Settings area (not caused by any odd last names)

In the Credit Card Settings (Choose Payment Methods >> Payment Settings >> Credit Card Settings), and look to the Card Type Select Box Options -switch this field to PLAIN TEXT, and get rid of all the HTML tags, and save.

Problem solved!

AttachmentSize
cc_drupal.JPG 39.48 KB
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
#21
Title:Re: Special characters in billing..SOLUTION» Special characters in billing info (customer name) breaks cc encryption
Assigned to:dmsky» Guest

@dmsky: Your post has nothing to do with this issue. Your image shows you have CKEditor enabled for the credit card type textarea, and it is CKEditor that is adding the paragraph tags. Regardless, that doesn't affect encryption at all.

This issue is being addressed in the Ubercart issue queue at http://drupal.org/project/issues/ubercart

<tr>.
RandallKent's picture
Offline
Joined: 07/27/2011
Juice: 6
#22

Issue addressed at http://drupal.org/node/704872 with patches available.