Forum Moderators: phranque
After taking a look at the source, I realized how simple it was. They had simply stuck in a <!-- which caused the browser to consider the rest of the page a comment. I hope I didn't just give anyone any ideas! :P
So anyway, I do not know enough about CGI to edit the file to strip out various commands, so does anyone know of a secure php or cgi guestbook which is secure? Thanks.
Edit: I guess the key thing would be for it to take <'s and >'s and convert them to <'s and >'s. But there might be some other exploits aside from that I am not thinking of.
A standard array is just a list, like $array = ('apple', 'banana', 'broccoli') but an associative array associates the item with some other variable, such as
$hash = (apple => fruit, banana => fruit, broccoli => vegetable);
An item in the list, or standard array, is given by $array[0] = 'apple' where the item in the hash is $hash{apple} = 'fruit'.
diamondgrl: Well, I will test it out and see if it works like above. The data is actually being used like this:
print GUESTBOOK "$form_data{'comments'}\n";
so if I can't use that function the way it is now, maybe I could do something like this:
$temp_comments = $form_data{'comments'};
$temp_comments =~ s/</\<\;/g;
$temp_comments =~ s/>/\>\;/g;
print GUESTBOOK "$temp_comments\n";
There is also 'email' 'url' and 'name' but it is simply added in the same way. Thanks.
If all you want is a very simple Perl/CGI guestbook, I would recommend the NMS guestbook script (and the other NMS scripts too):
$temp_comments =~ s/&/\&\;/g;
encyclo: It seems it's not really going to take much to patch this. Just a matter of checking for a few characters, and switching them out. At least now I know how to do it, and can repeat it in the future if I need to. It actually took quite a while before I found a guestbook script that worked just like I wanted to :) Most others come up with their own guestbook page, rather than a simple structure for inclusion into the pre-existing page.