Forum Moderators: coopster

Message Too Old, No Replies

Securing an Open API

How can you ensure only your requests are made to an API?

         

Sekka

1:59 pm on Jul 14, 2009 (gmt 0)

10+ Year Member



I'm making a Flash game ], and the scores are going to get posted to an API built in PHP.

We want to make this as secure as possible so people can't post their own manually.

The best idea we've come up with is to MD5 the score with a predefined SALT which is hardcoded in the SWF. The score and the result hash is then posted to the API. The API MD5's the score with the same SALT the SWF has and if it matches the passed result hash, the score is confirmed to have come from the SWF and is accepted.

The only security hole we can see is if someone decompiles the SWF, gets the code, and finds this SALT and how it is used. The % of users who would do this are slim to none though, so it's a margin we are willing to accept.

My question is, do any of you have experience in this area and how do you approach what we're trying to do?

Thanks in advance.

jatar_k

2:12 pm on Jul 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you approach is probably the best you can do

you have chosen a value that will be unknown to the majority of your users won't know. You may run into an issue if you were offering a cash prize as the number of people decompiling would increase.

You could make this more complex but there would be no advantage because it could be gained equally from decompiling.

Sekka

2:18 pm on Jul 14, 2009 (gmt 0)

10+ Year Member



Yeah. I know we will never make it 100% secure. That's the way with things like this.

But I just want to ensure we get it as secure as we can, and we'll just deal with hackers if we can.

jatar_k

2:32 pm on Jul 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think you've got it

th only other thing you could look at is having the server have more control, maybe a request before sending the scores? some piece of data that the server knows but the client doesn't?

I am not sure what that might be but those are the avenues to look at if you feel you need more security.

Sekka

2:41 pm on Jul 14, 2009 (gmt 0)

10+ Year Member



I was thinking of that too. But you can easily monitor the data going between the two using a proxy application like Charles, so it makes it kind of redundant.

Occam's razor applies here, and I think our original idea is the best we can do.