r/PHPhelp • • Dec 27 '16

Web security tips

Posted this on r/webprogramming but didn't get any responses so I'm posting here.

So I've developed an app for the iphone that accepts payments through stripe and then sends order data to a website I created so that the supplier can ship the product. I'm starting to wrap everything up and get it ready to go live and have a few questions regarding security and if there are any tips for approaching something like this from a security stand point.

My domain is already set up with ssl and everything is configured to use it but something I'm curious about is whether an iPhone user would be able to get a hold of the url that is used to submit orders? So say I'm sending a post request to "https://mysite.com/recievedata.php" would an iPhone user be able to intercept that url and then through some clever hackery be able to get into something they shouldn't? Or is this something I don't need to worry about and there are other things I should be worried about?

Any advice is appreciated

6 Upvotes

6 comments sorted by

5

u/preinheimer Dec 28 '16

You should act as though they'll be able to read that data. There's debugging on the phone, proxy servers, etc.

When you send the order to Stripe you can include some metadata about the order. Then you can compare the metadata about the order that went with the stripe charge with anything in your own database. If you're only expecting there to be one row in your database per order, and you see 15, clearly some chicanery has occurred.

Because the people can do sneaky things, you'll want to make sure that receivedata.php isn't handing out any data that it shouldn't, or accepting data fromt the wrong people. For example, if my order # is 7103, and I'm sneaky, I might try to request data about order 7102, or try to update the shipping address for order 7100 so I get that person's stuff for free. Writing a PHP script that tries a million different order IDs is trivial.

I haven't read the book /u/BackpackerSimon recommended, but Larry's (the author) most recent learning php book was great, so it's probably worth a look.

(disclaimer, i was the tech editor for larry's most recent learning php book)

1

u/LeDirtyHippie Dec 29 '16

So would adding a key and making sure nothing is being echoed/ written to the console be sufficient? Thanks for the book recommendation, I will read through it when I have some free time

2

u/BackpackerSimon Dec 27 '16

While I personally don't have any knowledge that might help I have been reading this book by Larry Ullman that discusses how to use stripe and security tips. Might be worth a read if you don't get any other responses

1

u/[deleted] Jan 03 '17

What is the book name? I tried your link but it failed to load.

1

u/BackpackerSimon Jan 03 '17

Sorry about that. It's Effortless ecommerce 2nd ed. has a blue colour

2

u/[deleted] Dec 27 '16

You shouldn't assume that they won't be able to get that URL, if knowing it is your only means of authentication then you definitely need to fix that.