House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search cf-talk

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  ColdFusion Talk (CF-Talk)

Preventing user from changing ID number in URL

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Howdy all,
Bruce Sorge
05/06/08 06:21 P
I would suggest:
William Seiter
05/08/08 10:55 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bruce Sorge
05/06/2008 06:21 PM

Howdy all, My help desk site I am building uses a URL variable for the ticket ID when the admin or user is viewing details, and I seem to recall reading somewhere that you can write your code so that if the user decides to change the ID number in the URL, it will default to the one they originally opened, thus keeping the user from viewing other tickets unless they go back and click on another one to open. Does anyone recall where this example is? I did a quick search but could not find it. Thanks, Bruce

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Phillip Vector
05/06/2008 06:27 PM

Store it in session.TicketID and don't pass it along via the URL at all. ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Alan Rother
05/06/2008 06:44 PM

This isn't exactly what you were asking about, but if your main concern is someone getting to see the details of a ticket that they shouldn't see, I recommend using an UUID for either the PK or a solid Secondary Key (if you are already using an auto incrementing Int as the primary key). Then pass the UUID through the URL, no one will likely ever find another string that matches your ticket numbers. =] -- Alan Rother Adobe Certified Advanced ColdFusion MX 7 Developer Manager, Phoenix Cold Fusion User Group, AZCFUG.org

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bruce Sorge
05/06/2008 07:10 PM

That would work except that they get to the ticket via a link. I guess I could make it into a button link and pass the session variable that way. Phillip Vector wrote: > Store it in session.TicketID and don't pass it along via the URL at all.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Phillip Vector
05/06/2008 07:17 PM

Well, I'm assuming that you have a set of links and the user clicks on one and it goes to the ticket.. Right? If so, once the link is clicked, do another query (the same that brought up his list of tickets) where ticketID = #url.ticketid# If it's showing up as no records, boot him out, cause a BSOD on his computer and send an email via cfmail to the paramilitary strike force to his house. :) ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Josh Nathanson
05/06/2008 06:43 PM

> My help desk site I am building uses a URL variable for the ticket ID > when the admin or user is viewing details, and I seem to recall reading > somewhere that you can write your code so that if the user decides to > change the ID number in the URL, it will default to the one they > originally opened, thus keeping the user from viewing other tickets > unless they go back and click on another one to open. Does anyone recall > where this example is? I did a quick search but could not find it. Can the server tell the difference between someone clicking a link, and someone entering an url in the address window of the browser?  That's what you have to contend with.  My hunch is that it's just an http request either way, so there's really not a way to do what you're looking for. -- Josh

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mary Jo Sminkey
05/08/2008 10:57 AM

>Can the server tell the difference between someone clicking a link, and >someone entering an url in the address window of the browser?  That's what >you have to contend with.  My hunch is that it's just an http request either >way, so there's really not a way to do what you're looking for. Exactly. I usually just add code on the server-side that double-checks the ID and make sure the user has access to it, and if not, bumps them to an error page. --- Mary Jo

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
William Seiter
05/08/2008 10:55 AM

I would suggest: Do a search on the url id and verify the current user is allowed to access it, if they are then set a session variable like 'session.lastticket', if they are not allowed, then do a search for the 'session.lastticket' if it exists.  Last resort cflocation them to the home page. This won't stop them from changing the url variable, but it will stop them from viewing unauthorized info. William ---------------------------------- William Seiter ColdFusion Web Developer / Consultant http://william.seiter.com Have you ever read a book that changed your life? Go to: http://www.winninginthemargins.com Use PassKey: GoldenGrove You'll be glad you did. ::-----Original Message----- :: ::Sent: Tuesday, May 06, 2008 3:21 PM ::To: CF-Talk ::Subject: Preventing user from changing ID number in URL :: ::Howdy all, ::My help desk site I am building uses a URL variable for the ticket ID ::when the admin or user is viewing details, and I seem to recall reading ::somewhere that you can write your code so that if the user decides to ::change the ID number in the URL, it will default to the one they ::originally opened, thus keeping the user from viewing other tickets ::unless they go back and click on another one to open. Does anyone recall ::where this example is? I did a quick search but could not find it. :: ::Thanks, :: ::Bruce :: ::

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Nathan Strutz
05/08/2008 10:57 AM

How about adding a querystring hash to your querystring. Follow me on this... Your links will change from href="myPage.cfm?id=5" to href="myPage.cfm?#buildLink("id=5")#". The buildLink (or whatever you call it) UDF will make a hash of your querystring plus a local salt, plus a session salt. buildLink will add the hash to your querystring, and produce something like this: href="myPage.cfm?id=5&secure=65ARE634HN4S564GA6" But that's not all... Have buildLink also encrypt your URL. Even the basic cfusion_encrypt() function will work. Your new link will be like href="myPage.cfm?9867BNS85NS95H9R86HS87R6H85S7FD8G" Then just add a filter on the other end to decrypt your encrypted query string, recreate the URL scope variables and verify that the string, minus the "secure" param (the hash) is the same as those other values, plus your salt values, hashed. Even still, it will not be 100% unhackable, but it will be closer. -- nathan strutz http://www.dopefly.com/ ----- Excess quoted text cut - see Original Post for more -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Brad Wood
05/06/2008 06:57 PM

Obscurity still isn't security though.  Better yet, run whatever security checks are necessary when displaying a ticket to verify the person logged in should be able to view it.  That really is the only way to be sure sensitive data isn't exposed to others.  All someone would need was a copy of the link or a network sniffer to pull out ids of tickets other people were viewing even if they were obfuscated (UUID's). ~Brad This isn't exactly what you were asking about, but if your main concern is someone getting to see the details of a ticket that they shouldn't see, I recommend using an UUID for either the PK or a solid Secondary Key (if you are already using an auto incrementing Int as the primary key). Then pass the UUID through the URL, no one will likely ever find another string that matches your ticket numbers.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bruce Sorge
05/06/2008 07:11 PM

Yeah, that would work. When they log in, their role is stored in a session variable so I could just do the check that way. Brad Wood wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
denstar
05/06/2008 08:27 PM

> Yeah, that would work. When they log in, their role is stored in a >  session variable so I could just do the check that way. That's the ticket! Then all you gotta watch out for is XSS session stealers...  :-P -- Limit the vectors whenever possible... /me tells himself

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
gary gilbert
05/08/2008 10:55 AM

I agree with brad in that only those people with access to the ticket should see it, then it doesnt matter if they manipulate the id it gets them nothing. Having role based security or resource based security will help prevent unauthorized users from manipulating the url to view a ticket that they shouldnt have access to.  That does tend to make things a bit more complicated though when designing your security framework. -- Gary Gilbert http://www.garyrgilbert.com/blog

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dominic Watson
05/08/2008 10:55 AM

> Obscurity still isn't security though.  Better yet, run whatever > security checks are necessary when displaying a ticket to verify the > person logged in should be able to view it.  That really is the only way > to be sure sensitive data isn't exposed to others.  All someone would > need was a copy of the link or a network sniffer to pull out ids of > tickets other people were viewing even if they were obfuscated (UUID's). Amen. There really is no problem with passing an int id in the url as long as some other variable to identify the user is also passed in and the neccessary security checks are performed. In SmarterTicket, the id is the user's email address. So a combination of user identity and ticket identity is required to view the ticket. You can choose to use a UUID or continue with using your plain ol int pk. I'd guess using a UUID would be better here; obscurity + security = obsecurity! Dominic -- Blog it up: http://fusion.dominicwatson.co.uk

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jeff Price
05/08/2008 10:56 AM

This is really the only acceptable solution. If you care about security, you need to verify every user action. >Yeah, that would work. When they log in, their role is stored in a >session variable so I could just do the check that way. > >Brad Wood wrote:

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Michael Stevens
05/08/2008 10:55 AM

Obscurity still isn't security though.  Better yet, run whatever security checks are necessary when displaying a ticket to verify the person logged in should be able to view it. ~Brad -- That's what we do. Each of our invoices is referenced in an invoice table by a few different pieces of data, the most important of which is the invoice number and the customer's account number. The ID in the url gets checked to see if the logged in account number is in the same row as the invoice and if not they get a "not a valid invoice under your account" error. Mike

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
05/08/2008 10:57 AM

> Obscurity still isn't security though.  Better yet, run > whatever security checks are necessary when displaying a > ticket to verify the person logged in should be able to view > it.  That really is the only way to be sure sensitive data > isn't exposed to others. This really is the only correct answer. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Training: Adobe/Google/Paperthin Certified Partners http://training.figleaf.com/ WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers! http://www.webmaniacsconference.com/


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists