Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
Franklin Cross #1
Web form security - REreplaceNoCase or is there something better?
What is the best way to prevent users in a BB type scenario from posting
script or SQL into a textfield or textarea? Making changes to the
administrator is not an option.
I figured there must be something better than REreplaceNoCase. However, if
REreplaceNoCase is the best option, does anyone have a readymade snippet of
code that will encompass the most malicious tags, SQL attacks, etc?
Franklin Cross Guest
-
PHP - upload files thru form - security question
I finally succeeded in uploading files to a server thru a PHP-form. Last obstacle was permission denied to copy the file from tmp directory to the... -
Web form w/ Access DB Security
I am deploying a web form developed in VB.NET using an OleDB connection to an Access DB. I am able to deploy the app with the DB residing in the... -
Form security for database
Hi, I don't find anywhere the answer to my question so I try to ask here. I have in my pages different form fields ("find", "password", "message").... -
Webservices, Windows form security problem.
I did a simple webservice that i call from a even simplier windows form. I put the windows form code in the virtual folder created by the... -
Form-based security and Application_AuthenticateRequest - help?!
Hi there, Getting into ASP.Net finally, looks good but I'm having a bit of trouble here. I'm protecting my web site via form-based security (I... -
Cam Penner #2
Re: Web form security - REreplaceNoCase or is there something better?
In article <Ljs7f.472$rE2.134@fe10.lga>, CrossBaby111
@hotmail.com says...One of the best ways is to use <cfqueryparam> statements in> What is the best way to prevent users in a BB type scenario from posting
> script or SQL into a textfield or textarea? Making changes to the
> administrator is not an option.
>
> I figured there must be something better than REreplaceNoCase. However, if
> REreplaceNoCase is the best option, does anyone have a readymade snippet of
> code that will encompass the most malicious tags, SQL attacks, etc?
your SQL to limit the datatypes passed in.
--
Cam
Cam Penner Guest
-
Franklin Cross #3
Re: Web form security - REreplaceNoCase or is there something better?
"Cam Penner" <cam.pennerATpleasedontspamgoldmedalsystems.com@ho tmail.com>
wrote in message news:MPG.1dc7f2dae73439c29896ea@news.gv.shawcable. net...Can you give me an example of how this is used?> In article <Ljs7f.472$rE2.134@fe10.lga>, CrossBaby111
> @hotmail.com says...>>> What is the best way to prevent users in a BB type scenario from posting
>> script or SQL into a textfield or textarea? Making changes to the
>> administrator is not an option.
>>
>> I figured there must be something better than REreplaceNoCase. However,
>> if
>> REreplaceNoCase is the best option, does anyone have a readymade snippet
>> of
>> code that will encompass the most malicious tags, SQL attacks, etc?
> One of the best ways is to use <cfqueryparam> statements in
> your SQL to limit the datatypes passed in.
>
> --
> Cam
Franklin Cross Guest
-
Cam Penner #4
Re: Web form security - REreplaceNoCase or is there something better?
In article <oNs7f.17620$1X1.14993@fe12.lga>, CrossBaby111
@hotmail.com says...[url]http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags[/url]>
> "Cam Penner" <cam.pennerATpleasedontspamgoldmedalsystems.com@ho tmail.com>
> wrote in message news:MPG.1dc7f2dae73439c29896ea@news.gv.shawcable. net...>> > In article <Ljs7f.472$rE2.134@fe10.lga>, CrossBaby111
> > @hotmail.com says...> >> >> What is the best way to prevent users in a BB type scenario from posting
> >> script or SQL into a textfield or textarea? Making changes to the
> >> administrator is not an option.
> >>
> >> I figured there must be something better than REreplaceNoCase. However,
> >> if
> >> REreplaceNoCase is the best option, does anyone have a readymade snippet
> >> of
> >> code that will encompass the most malicious tags, SQL attacks, etc?
> > One of the best ways is to use <cfqueryparam> statements in
> > your SQL to limit the datatypes passed in.
> >
> > --
> > Cam
> Can you give me an example of how this is used?
-b20.htm
--
Cam
Cam Penner Guest
-
Franklin Cross #5
Re: Web form security - REreplaceNoCase or is there something better?
"Cam Penner" <cam.pennerATpleasedontspamgoldmedalsystems.com@ho tmail.com>
wrote in message news:MPG.1dc7fb6214c295d59896eb@news.gv.shawcable. net...This still does not explain how this feature can be used to filter out> In article <oNs7f.17620$1X1.14993@fe12.lga>, CrossBaby111
> @hotmail.com says...>>>
>> "Cam Penner" <cam.pennerATpleasedontspamgoldmedalsystems.com@ho tmail.com>
>> wrote in message news:MPG.1dc7f2dae73439c29896ea@news.gv.shawcable. net...>>>> > In article <Ljs7f.472$rE2.134@fe10.lga>, CrossBaby111
>> > @hotmail.com says...
>> >> What is the best way to prevent users in a BB type scenario from
>> >> posting
>> >> script or SQL into a textfield or textarea? Making changes to the
>> >> administrator is not an option.
>> >>
>> >> I figured there must be something better than REreplaceNoCase.
>> >> However,
>> >> if
>> >> REreplaceNoCase is the best option, does anyone have a readymade
>> >> snippet
>> >> of
>> >> code that will encompass the most malicious tags, SQL attacks, etc?
>> >
>> > One of the best ways is to use <cfqueryparam> statements in
>> > your SQL to limit the datatypes passed in.
>> >
>> > --
>> > Cam
>> Can you give me an example of how this is used?
> [url]http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags[/url]
> -b20.htm
>
> --
script and SQL from a large textblob.
Franklin Cross Guest
-
Bob Dively #6
Re: Web form security - REreplaceNoCase or is there something better?
In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com> wrote:
[re: cfqueryparam]
: This still does not explain how this feature can be used to filter out
: script and SQL from a large textblob.
Cfqueryparam doesn't filter out anything. It does prevent SQL
injection attacks by preventing any SQL in a form field from
being evaluated.
--
Bob Dively | I used to be indecisive, but now I'm not sure...
Bob Dively Guest
-
Franklin Cross #7
Re: Web form security - REreplaceNoCase or is there something better?
"Bob Dively" <dive@panix.com> wrote in message
news:djlr6l$qq7$4@reader2.panix.com...But how can I prevent people from executing malicious scripts in a textarea?> In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com>
> wrote:
>
> [re: cfqueryparam]
>
> : This still does not explain how this feature can be used to filter out
> : script and SQL from a large textblob.
>
> Cfqueryparam doesn't filter out anything. It does prevent SQL
> injection attacks by preventing any SQL in a form field from
> being evaluated.
>
Or for that matter, inserting pornographic image tags into it?
Franklin Cross Guest
-
Franklin Cross #8
Re: Web form security - REreplaceNoCase or is there something better?
"Bob Dively" <dive@panix.com> wrote in message
news:djlr6l$qq7$4@reader2.panix.com...What I meant by the pornographic img tags is how do I prevent them from> In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com>
> wrote:
>
> [re: cfqueryparam]
>
> : This still does not explain how this feature can be used to filter out
> : script and SQL from a large textblob.
>
> Cfqueryparam doesn't filter out anything. It does prevent SQL
> injection attacks by preventing any SQL in a form field from
> being evaluated.
>
> --
> Bob Dively | I used to be indecisive, but now I'm not sure...
using any sort of html code, javascript, etc.
Franklin Cross Guest
-
Bob Dively #9
Re: Web form security - REreplaceNoCase or is there something better?
In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com> wrote:
: But how can I prevent people from executing malicious scripts in a textarea?
: Or for that matter, inserting pornographic image tags into it?
You can use ReReplaceNoCase to remove tags that you don't want:
<cfset test = '<script language="JavaScript">script contents</script>'>
<cfset test = ReReplaceNoCase(test, "<script.*>.*</script>", "", "ALL")>
For IMG tags:
ReReplaceNoCase(form_var, "<img.*>", "", "ALL")
Those examples don't cover all cases. Regular expressions are
tricky, so test a lot.
There are also several custom tags available:
[url]http://www.cflib.org/udf.cfm?ID=774[/url]
[url]http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn130#loc=en_us&view=sn106&viewName =Exchange%20Search%20Details&authorid=33572169&pag e=0&scrollPos=0&subcatid=0&snid=sn106&itemnumber=3 &extid=1002316&catid=0[/url]
Or you can google for "coldfusion strip html" or something
similar.
--
Bob Dively | I used to be indecisive, but now I'm not sure...
Bob Dively Guest
-
George Farnsworth #10
Re: Web form security - REreplaceNoCase or is there something better?
What I do is test for the existance of any "<" with plain old CFFind and if
I see one, reject the submission with an appropriate note to the submitter.
As far as html, that should fix it. If someone does insert a plain link --
like [url]www.xyz.com[/url] -- without an anchor tag -- there's not much you can do, I
think. But at least a visitor who sees it will have to cut-and-paste it into
a browser.
"Franklin Cross" <CrossBaby111@hotmail.com> wrote in message
news:Bju7f.18009$1X1.7394@fe12.lga...>
> "Bob Dively" <dive@panix.com> wrote in message
> news:djlr6l$qq7$4@reader2.panix.com...>>> In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com>
>> wrote:
>>
>> [re: cfqueryparam]
>>
>> : This still does not explain how this feature can be used to filter out
>> : script and SQL from a large textblob.
>>
>> Cfqueryparam doesn't filter out anything. It does prevent SQL
>> injection attacks by preventing any SQL in a form field from
>> being evaluated.
>>
>> --
>> Bob Dively | I used to be indecisive, but now I'm not sure...
> What I meant by the pornographic img tags is how do I prevent them from
> using any sort of html code, javascript, etc.
>
George Farnsworth Guest
-
Franklin Cross #11
Re: Web form security - REreplaceNoCase or is there something better?
"George Farnsworth" <GeorgeF@GFonline.org> wrote in message
news:9av7f.20258$hP6.12345@trnddc05...huh? I never heard of CFFind. Is this new? It isn't listed in any of my> What I do is test for the existance of any "<" with plain old CFFind and
> if I see one, reject the submission with an appropriate note to the
> submitter. As far as html, that should fix it. If someone does insert a
> plain link -- like [url]www.xyz.com[/url] -- without an anchor tag -- there's not
> much you can do, I think. But at least a visitor who sees it will have to
> cut-and-paste it into a browser.
>
>
books and a search for information about it yielded nothing.
Franklin Cross Guest
-
Franklin Cross #12
Re: Web form security - REreplaceNoCase or is there something better?
"Bob Dively" <dive@panix.com> wrote in message
news:djlt4j$7q8$1@reader2.panix.com...Ok thanks again Bob. I will go investigate these.> In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com>
> wrote:
>
> : But how can I prevent people from executing malicious scripts in a
> textarea?
> : Or for that matter, inserting pornographic image tags into it?
>
> You can use ReReplaceNoCase to remove tags that you don't want:
>
> <cfset test = '<script language="JavaScript">script contents</script>'>
> <cfset test = ReReplaceNoCase(test, "<script.*>.*</script>", "", "ALL")>
>
> For IMG tags:
>
> ReReplaceNoCase(form_var, "<img.*>", "", "ALL")
>
> Those examples don't cover all cases. Regular expressions are
> tricky, so test a lot.
>
> There are also several custom tags available:
>
> [url]http://www.cflib.org/udf.cfm?ID=774[/url]
> [url]http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn130#loc=en_us&view=sn106&viewName =Exchange%20Search%20Details&authorid=33572169&pag e=0&scrollPos=0&subcatid=0&snid=sn106&itemnumber=3 &extid=1002316&catid=0[/url]
>
> Or you can google for "coldfusion strip html" or something
> similar.
>
> --
> Bob Dively | I used to be indecisive, but now I'm not sure...
Franklin Cross Guest
-
Bob Dively #13
Re: Web form security - REreplaceNoCase or is there something better?
In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com> wrote:
: "George Farnsworth" <GeorgeF@GFonline.org> wrote in message
: news:9av7f.20258$hP6.12345@trnddc05...
: > What I do is test for the existance of any "<" with plain old CFFind and
: huh? I never heard of CFFind. Is this new? It isn't listed in any of my
: books and a search for information about it yielded nothing.
I'm sure that he meant "CF Find", as in ColdFusion's standard Find
function.
--
Bob Dively | I used to be indecisive, but now I'm not sure...
Bob Dively Guest
-
Franklin Cross #14
Re: Web form security - REreplaceNoCase or is there something better?
"Bob Dively" <dive@panix.com> wrote in message
news:djm1ic$erl$1@reader2.panix.com...Ah, that clears it up. Yeah I avoided using Find() because of its> In alt.comp.lang.coldfusion Franklin Cross <CrossBaby111@hotmail.com>
> wrote:
>
> : "George Farnsworth" <GeorgeF@GFonline.org> wrote in message
> : news:9av7f.20258$hP6.12345@trnddc05...
> : > What I do is test for the existance of any "<" with plain old CFFind
> and
>
> : huh? I never heard of CFFind. Is this new? It isn't listed in any of my
> : books and a search for information about it yielded nothing.
>
> I'm sure that he meant "CF Find", as in ColdFusion's standard Find
> function.
>
restriction of only being able to specify a single string, so (the way my
limited mind envisions it) I would run about a thousand cfif statements for
each tag I didn't want. Although actually this might work for just alerting
people they can't use a < in their submissions.
Franklin Cross Guest
-
Weary #15
Re: Web form security - REreplaceNoCase or is there something better?
Try this:
[url]http://tinyurl.com/bdqey[/url]
Weary Guest
-
Peter Tilbrook #16
Re: Web form security - REreplaceNoCase or is there something better?
Franklin Cross wrote:
Franklin, have reviewed your question, and definately using CFQUERYPARAM> What is the best way to prevent users in a BB type scenario from posting
> script or SQL into a textfield or textarea? Making changes to the
> administrator is not an option.
>
> I figured there must be something better than REreplaceNoCase. However, if
> REreplaceNoCase is the best option, does anyone have a readymade snippet of
> code that will encompass the most malicious tags, SQL attacks, etc?
>
>
is the best way to verify input to a particular database table record
(eg use maxlength 16 and any longer would fail). Do not neglect client
side validation but do not depend on it as it can be circumvented - the
reasonf for CFQUERYPARAM.
But am not satisfied so have asked further afield for advice and will
come back.
But you asked a bloody good question - one of the better ones of late -
so this demands a good answer!
BRB!
Peter Tilbrook
Manager, ACTCFUG.
Peter Tilbrook Guest
-
Peter Tilbrook #17
Web form security - suggestions - part 1
Bob (Divvit) is right.
SQL "injection" is the ability to execute database code through a
standard HTML "FORM" or values cleverly appended to say a URL (or
another diabolical method). There may even be much more devious methods.
It is really nasty and potentially disastrous!
The trick is to fool the application server - for this discussion the
CFML engine - to execute the injected code.
For example it used to be possible to "DROP" all tables from your
database using SQL injection through CFML.
How do you inject SQL?
Peter Tilbrook Guest
-
Peter Tilbrook #18
Re: Web form security - REreplaceNoCase or is there something better?
Franklin Cross wrote:
Franklin, this response from Tim Buntel of MM:> What is the best way to prevent users in a BB type scenario from posting
> script or SQL into a textfield or textarea? Making changes to the
> administrator is not an option.
>
> I figured there must be something better than REreplaceNoCase. However, if
> REreplaceNoCase is the best option, does anyone have a readymade snippet of
> code that will encompass the most malicious tags, SQL attacks, etc?
>
>
Client side validation has been beefed up in CF 7, too. A regex on the
client can help restrict content that gets posted before it even gets to
the server. You could also consider using the scriptProtect attribute
of the cfapplication tag. That provides an easy way to filter out
certain tag names to help prevent cross site scripting attacks.
I’m not aware of any readymade scripts, though…
CFFORM has for a while supported the scriptsrc" attribute. It was mainly>>
for the poor shared hosting ppl. But think about it. Het your own
scripts AOK'ed...
So basically help Tim Buntel and the rest of the team make this a no
brainer. We cannot do your work for you as it differs each project.
Hold tight as MM are on the ball!
PT, ACTCFUG
Peter Tilbrook Guest
-
Peter Tilbrook #19
Re: Web form security - REreplaceNoCase or is there something better?
Franklin Cross wrote:
Might cost a bit (US$100 per site) but ActiveEdit works well. Slow. But> What is the best way to prevent users in a BB type scenario from posting
> script or SQL into a textfield or textarea? Making changes to the
> administrator is not an option.
>
> I figured there must be something better than REreplaceNoCase. However, if
> REreplaceNoCase is the best option, does anyone have a readymade snippet of
> code that will encompass the most malicious tags, SQL attacks, etc?
>
>
works!
Peter Tilbrook Guest
-
Peter Tilbrook #20
Re: Web form security - REreplaceNoCase or is there something better?
You could also consider using the scriptProtect attribute
Pretty sure this is only with ColdFusion MX 7.01 (basically the cool> of the cfapplication tag. That provides an easy way to filter out
> certain tag names to help prevent cross site scripting attacks.
>
updater).
It is a free patch that will let you lock down both dev and production
servers. Infact apply the latest patches for IIS (if you use IIS) or
JRun4 Updater 6 if you use the JRun which craps on IIS at any rate. This
will also fix many MySQL issues. Which by the way V5 has been released.
How long can you hold Your breath?
Peter Tilbrook Guest



Reply With Quote

