Scott Koon* (aka Lazycoder) has a post on his blog talking about potential side effects of the RoR and ASP.NET+MVC (among others) URL convention of /[Controller]/[Action]/[Params] where you might end up with /LifeSupportSystems/Delete/15 in a URL that a search spider might hit and cause bad things to happen.

Of course, you would have taken steps to ensure that not just anyone can hit /Delete/15 and have it do something.  And it's also not likely that a would-be hacker might even get to see something that even links to /Delete/15 to know that it exists. But even a not-so-clever hacker could figure out that if your other sites have things like /LifeSupportSystems/Details/15  that other verbs instead of 'Details' might be interesting and that's just one more piece of information he might have to use against you.

Ok, that may be an extreme example, but I could think of many more where a simple query-/read-only URL like /Product/Details/15 might lead someone to try 15, 16, 17, etc and stumble upon something that maybe they weren't necessarily supposed to see.

My point here is this:  Predictable IDs presented anywhere to the client (even buried in your HTML in hidden form variables) is bad.  In fact, I might even go so far as to say ANY direct ID used by the persistence mechanism (i.e. database) should NOT be available at all to the client.

Taking this idea (about embedding some sort of random key that only the original HTML-producing server knows about to prevent random posts from XSS-style attacks) and going a little further by encrypting or otherwise obfuscating the ID's using that same random key will grant you even more security.

Generating pseudo ID's used only for that request that are then later re-translated/converted back into the naked DB ID's will help prevent any sort of random guessing attacks.

If anyone is interested and I don't get flamed for this idea by the community at large, I may write some samples on how to do this in ASP.NET Web Forms (with an eye towards upcoming ASP.NET+MVC -- i.e. not using ViewState encryption). 

Thoughts?

 

* Is everyone who's anyone named Scott anymore? When did the Scott invasion start? I'm thinking of changing my name soon.