Ask HN: Flex/Flash, Authenticating your .swf + decompiling
In a nutshell, we are developing a web app where our app and flex fontend need to share data securely. The problem is that our application server needs to know that the requests we are getting from our flex application are not spoofed.
Right now we essentially have a secret key that is hashed with request data to authenticate the flex app.
Problem is, how do we keep the secret key in the flex app code without someone able to snag it by decompiling? I can think of a million ways to obscure the key into the code, but that only will delay a break in, not stop it.
It seems impossible for there to be any secure cryptographic system if an intruder can see the source.
Is there any good way to actually secure flex from getting decompiled? From what I have seen everything just obscures code.
(
11 comments
| 9 points
| on HN
)
One of the fundamental rules in security training is never trust the client.
Anything you can write, they can open. For the most part, it won't even be that hard. Don't waste time obfuscating it..
If it's at all possible, time would be better spent redesigning the infrastructure such that the client never has any data that you don't want the user to have.. The best way to do this is to generalize an API that the backend uses to talk to the front end. Then, modify your client to use this.
We do this with Chron X- We have a generic Card game API that we call from our Client.. It's not perfect, but we're actively making design decisions assuming that someday, other clients may connect, with or without our consent and blessing. We may never allow it, but we have to work under the mindset that the hackers can do anything our Flex can.
I'd suggest writing a middleware layer, which takes in requests based on a sessionID, and then allows only certain commands to go through, and only certain data to come back. That way, you minimize your exposure.
http://livedocs.adobe.com/flashmediaserver/3.0/docs/03_confi...
Anyway, you can obscure the key into the code all you want. If it's a string value there's only one place it will ever be when the .swf is decompiled and that's in the constant pool. If it's a number value stored in a variable or even a few concatenated strings it might be a little more difficult since it's not going to come out and slap somebody in the face, but to say it's trivial to retrieve the key would be the understatement of the decade. Before going this route it might be a good idea to decompile some .swf files to see what it looks like. Check out a program called Describe SWF and take a look at the documentation for Flasm. Lots of good info there.
There's no good way to secure your Flash/Flex code so it's not worth the effort to even entertain the thought. I develop a bot with a custom Flash player and I'm just amazed out how many people do stuff like this. The best advice I can give you is that anything you put in a Flash file is there for the taking as if you were advertising on your home page. Bad idea.
Has anyone had success with making flash decompiling more difficult?
Anyone used http://www.amayeta.com/ ?
Or am I really missing something and should just stop commenting? :)
In other words, your EULA/terms-of-service is a long the lines of "you are responsible for the user of this service using your login credentials, which can be revoked at any time if we perceive you to be violating the terms of service". Then becomes a little more manageable as a social problem (which it is), rather than solely relying on a technical solution to a social problem.