CastleCops, Internet Crime Fighters
Need help? Click here to register for free! Absolutely zero advertisements on this site!

$9736.22 of $21422.68
left sidedonated so farneed $11686.46 donated to reach our goalright side, our goal
Help CastleCops serve the community on new servers, Donate Here to reach our goal.

Donation/Premium
spacer
block bottom
Security Central
spacer
· Home
· PIRT/Fried Phish
· MIRT
· SIRT
· Deutsch
· Wiki
· Newsletter
· O16/ActiveX
· CLSID List
· Contest2007
· Downloads
· Feedback (send)
· Forums
· HijackThis
· Hijacktrend
· LSPs
· My Downloads
· O18
· O20
· O21
· O22
· O23
· O9
· Premium
· Private Messages
· Proxomitron
· Reviews
· Search
· StartupList
· Stories Archive
· Submit News
· WsIRT
· Your Account
· Acceptable Use Policy
block bottom
Survey
spacer
Was 2007 a good year?

Yes it was a wonderful year
Yes, but there is always room for improvement
Status quo
It was a challenge
Other (leave comment)



Results
Polls

Votes: 951
Comments: 28
block bottom
spacer spacer
image Applying Myself: Practicing safe text image
CastleCops

Practicing Safe Text







By Richard Lindberg, aka RiBiNiN, CastleCops Staff Writer
October 20, 2006


A couple of years ago the Santy worm was a big problem on phpBB systems. This was a bug that allowed a Perl script to be placed in a text comment and when the text was viewed the script ran. Websites were defaced and in some cases simply abandoned because they couldn’t be rebuilt without more effort than the owner wished to expend.

What is proper validation for a text field? This is a tough situation for the developer. If it is too loose, you can get SQL injection or cross site scripting problems. If it is too tight, you get user complaints. Consider this code.
function isSafeText($Text)
{
  if (ereg("<|%|'", $Text)) 
  {
    return false;
  }
  return true;
}
Not allowing these three characters will protect you from almost all the possible text field problems. The problem is that it can’t fail to annoy people writing comments since there are perfectly valid reasons that one or the other of these characters might be part of what they wrote. Besides that, it does nothing about SPAM in comments.

Are there any general rules that can be applied to free-form text fields?

* * * * *

Last time I asked what the coding error was that made it likely that bugs would be introduced when the code was maintained. There were two problems.

The first was that there are two attributes that need to be checked and I tried to check them both before the function using them was called. That’s fine for checking that the parameter exists, but not for its content. That should be done within the function.

The second was that I made the assumption that the output message would be two characters longer than the sum of the lengths of the input parameters. That’s right [b]now[/b] but may not be in the future.
Posted on Friday, 20 October 2006 @ 09:37:04 UTC by Robin (1569 reads)
[ Trackback ]
image

"Applying Myself: Practicing safe text" | Login/Create an Account | 1 comment | Search
Threshold
The comments are owned by the poster. We aren't responsible for their content.

No Comments Allowed for Anonymous, please register

Description of Exploit Severely Lacking (Score: 1)
by PhantomCircuit (phantomcircuit[AT]yahoo.[FAKE]com)  on Sunday, 22 October 2006 @ 15:00:03 UTC
(User Info | Send a Message) http://phantomcircuit.mine.nu
The explot that the santy worm used was actually caused by not filtering the highlight get variable, which was used to highlight the search term in search results. this occured because they had used an executable regex as part of the validation process for the highlight variable (ironic that the security was the flaw, no?).

anyways just thought id point that out.


 
Login
spacer
Nickname

Password

Security Code: Type Security Code: Usage signifies AUP acceptance
· New User? · Click here to create a registered account.
block bottom
Related Links
spacer
· del.icio.us!
· digg it!
· reddit!
· TrackBack (0)
· PHP HomePage
· HotScripts
· W3 Consortium
· Spam Cop
· CastleCops
· More about CastleCops
· News by Robin


Most read story about CastleCops:
Acceptable Use Policy

block bottom
Article Rating
spacer
Average Score: 5
Votes: 1


Please take a second and vote for this article:

Bad
Regular
Good
Very Good
Excellent


block bottom
Options
spacer

Printer Friendly Page  Printer Friendly Page

block bottom
spacer spacer