r/shittyprogramming • u/Tuxmascot • Dec 26 '14
Hacking The Interview (x-post from /r/hacking)
http://imgur.com/a/hf8FZ33
u/Runngunn Dec 26 '14
Its been patched =c. Comments of test codes removed and gives an error when you try to use the test card.
34
u/emcniece Dec 26 '14
test api key regenned. Great example of how "real hacking" can be just catching shitty code though.
58
u/rasputine Dec 26 '14
That's kinda what all hacking is, sometimes it's just more complex to take advantage of the shitty code
28
u/novelty_string Dec 26 '14
A lot, but not all. Social engineering and hardware attacks are also popular vectors.
3
Dec 27 '14
Using Facebook to convince someone to give you their passwords qualifies as using both social engineering and shitty code!
11
u/SwissPatriotRG Dec 26 '14
We have these tests we have to take for work for compliance with certain laws in the financial industry. It can take hours to get through the material and the test has to pass with a certain percentage or your managers are notified. Most of the tests have no bearing on the work I do, so I dug into the Javascript, pulled out the code that evaluated the answers client side (this is where they fucked up), debugged it and can see the answers to the test when it loads and finish any test in minutes when they used to take hours.
Moral of the story? It's not necessarily hacking if you can debug and manipulate client side code to get what you want. That is just lazy developers writing shitty code.
18
u/matejdro Dec 26 '14
What does math random do? Assigns 50% of people different key?
6
u/charliebruce123 Dec 26 '14
Perhaps it's very simple load balancing? So that half of the clients deal with one server, and half of them deal with the other server.
14
Dec 26 '14
[removed] — view removed comment
15
u/charliebruce123 Dec 26 '14
I'd guess it's basic load balancing - half of the users deal with one server, and half of them deal with another.
11
5
4
u/cmd-t Dec 30 '14
It's obvious: 50% of the money goes to Seth Rogen and the other 50% to James Franco!
14
u/ghillisuit95 Dec 26 '14
I don't get it, though I am not a javascirpt/webdev guy at all. the function just seems to be doing some UI stuff. Here it is in full:
var handler = StripeCheckout.configure(
{
key: sk,
token: function(token) {
$( '#customButton' ).unbind( 'click' );
$( '#customButton' ).prop( 'disabled', true );
if ( token.description ) {
window.location.href = token.description;
}
else {
// Handle this error
}
},
name: 'Rent The Interview',
description: '$5.99 for 48 hours',
amount: 0599,
currency: 'USD',
image: 'images/checkoutimage.jpg',
panelLabel: 'Rent {{amount}}',
allowRememberMe: false,
closed: function () {},
opened: function () {}
}30
u/emcniece Dec 26 '14
The lines before where
skis defined is important too - "sk" is the key that defines whether the test API should be used, or if the live API is used.If the test API is used, we can enter a typical test credit card info pattern: 424242.... CVC 123.
18
u/Diirge Dec 26 '14
Blows my mind this would be pushed live
8
u/wescotte Dec 27 '14
Look on the bright side. At least they were smart enough to create a test API.
11
u/hypermegaglobal Dec 26 '14
I don't think this would have worked as Stripe Checkout only creates a token. The actual credit card charge has to be created on the server using the token and a secret key. Trying to use a public 'test' key with a secret 'live' key would have resulted in an error and not in an apparently successful charge.
2
7
17
u/WhosAfraidOf_138 Dec 26 '14
The biggest question is - why is this done on client-side?!
26
-7
u/OrionBlastar Dec 27 '14
Bwahahahaha, most stuff is done in JavaScript on the client side. Like validating credit cards and logging into a network and validating it.
This is to keep the traffic off the server processing it.
If you go into debug mode in your Web browser you can edit the JavaScript to fake a credit card or logging in.
Why do you think 90% of Startups fail? Why do you think JavaScript is in such high demand?
6
u/SumWon Dec 27 '14
That's actually just not true...
2
u/OrionBlastar Dec 28 '14
Yet for this website on renting The Interview it is true.
2
u/SumWon Dec 30 '14
Also, I know this is really late, but I'd just like to add that credit card validation was not being done in JavaScript on the client side in this case. The source code exposed values for the test API which allowed you to send bogus credit card info to the server which would always validate it.
I've never seen credit card information being validated in JS. That's pretty ridiculous lol.
1
7
u/Paul-ish Dec 26 '14
Client side checking? Damn.
10
u/level1kid Dec 26 '14
It's not client side. They just left the test API keys in as comments. The card information is verified on stripe's servers but the test keys will allow you to bypass that verification.
1
2
u/flynnski Dec 27 '14
That's super weird. The cc processing APIs I've worked with don't let you use test credentials on live servers, and they won't let you use live credentials on test servers. Different URLs too.
If this worked, there's some bigger shit wrong, I feel like.
3
Dec 27 '14
Thats the thing, the token to use the test server which accepts bogus cc info was left in the code as a comment
2
91
u/SuperFLEB Dec 26 '14
So I wonder if the big Sony Pictures hack involved finding...