While working on my new chat room project using CFAJAX, I discovered a pretty nasty security flaw in the cfajax framework.
Basically, if you have built an application that takes user input as a text string, and passes that text string to a coldfusion function on the server, then chances are good that your application allows people to execute CFML code on your server that you don't want them to.
I discovered it when I was having trouble with my chat application and the double quote mark ". Any time I used a double quote in whatever I typed and sent to the server, it would cause a CFML error on the back said.
I realized that if I typed the following line, the CFML in the middle would be executed:
foo " & now() & " foo
And then someone else noticed that you could type in #Now()# and it would be executed on the server.
The flaw is basically in the way cfajax (in the file cfajax.cfm) constructs the functionName variable.
To resolve the problem, on or around line 92, in the listAppend() command that appends to the variables.param list, you have to escape both quotes and pound signs by doubling them up, as follows:
<cfset variables.param = ListAppend(variables.param,"""" &
Replace(Replace(mid(variables.var, variables.firstPos+1 ,
len(variables.var)-variables.firstPos),Chr(34),"#Chr(34)##Chr(34)#","ALL"),Chr(35),"#Chr(35)##Chr(35)#","ALL")
& """")>
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
No comments found.
Post a comment (login required)