Thank you all for the comments so far.
The program is a message board, so the only time the user data
is used directly is when a page is generated.
I was trying to use the method of specifying what I will allow
as mentioned by Merlin. Of all the potential input fields, there
are 4 that I had to specify what I won't allow instead of what I will allow.
This is because these fields can contain HTML. Since there are a lot of
acceptable tags I thought it prudent to specify the ones I don't want.
I've read all I can find on security with CGI's and never found
much that directly related to my program, but after
seeing all the different methods used to attack a program
I thought I'd better do some basic filtering.
This problem grew because I don't spend my time trying to break
other peoples code, I am probably unaware of common "hack" attempts.
I know my code leave it possible to have an unbalanced tag like the
<table> tag
and thus the generated page may not display but I haven't found
any method that will match opening and closing tags.
In the hopes that I'm not becoming completly paranoid,
is there any standard filtering that I'm not using
to minimize vulnerability ?
Thanks for all the advice, you guys will make a programmer out of me yet!
-- Brian
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.