<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>88926</bug_id>
          
          <creation_ts>2005-04-12 23:17 0000</creation_ts>
          <short_desc>www-apps/wordpress XSS, HTML and SQL injection</short_desc>
          <delta_ts>2006-05-18 17:18:45 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Security</product>
          <component>Vulnerabilities</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <status_whiteboard>B4 [glsa] jaervosz</status_whiteboard>
          
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>94512</dependson>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>jaervosz@gentoo.org</reporter>
          <assigned_to>security@gentoo.org</assigned_to>
          <cc>rajiv@gentoo.org</cc>
    
    <cc>redhatter@gentoo.org</cc>
    
    <cc>superlag@gentoo.org</cc>
    
    <cc>tom@tomaw.net</cc>
    
    <cc>web-apps@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-12 23:17:43 0000</bug_when>
            <thetext>Reported on BT. No link as I can&apos;t reach SecurityFocus atm:

============================================================
Title: WordPress XSS and HTML injection
Vulnerability discovery: SoulBlack - Security Research -
http://soulblack.com.ar
Date: 12/04/2005
Severity: Medium. users can obtain cookies of other users and defacement website
Affected version: &lt;= 1.5
============================================================

============================================================
*Summary
http://wordpress.org. Wordpress is a popular blogging system built on
PHP (the scripting language) and is licensed under the GPL. It is free
software supported by a large and vibrant community of users. You can
use WordPress as a stand-alone application to publish your web log, or
incorporate its functionality into an existing site.

============================================================
*Problem Description:
Bug is in the content and </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-12 23:17:43 0000</bug_when>
            <thetext>Reported on BT. No link as I can&apos;t reach SecurityFocus atm:

============================================================
Title: WordPress XSS and HTML injection
Vulnerability discovery: SoulBlack - Security Research -
http://soulblack.com.ar
Date: 12/04/2005
Severity: Medium. users can obtain cookies of other users and defacement website
Affected version: &lt;= 1.5
============================================================

============================================================
*Summary
http://wordpress.org. Wordpress is a popular blogging system built on
PHP (the scripting language) and is licensed under the GPL. It is free
software supported by a large and vibrant community of users. You can
use WordPress as a stand-alone application to publish your web log, or
incorporate its functionality into an existing site.

============================================================
*Problem Description:
Bug is in the content and  title of post, when not controlling the
entrance of  characters, being able to inject HTML code

============================================================
*Example:
Type in the title or content of post

  &lt;script&gt;alert(document.cookie)&lt;/script&gt;

  &lt;iframe src=http://othersite/sb.php&gt;

============================================================
*Fix:
  wordpress\wp-includes\template-functions-post.php

function get_the_title($id = 0) {
        .
        .
        .
        return $title;
}

replace for by function

function get_the_title($id = 0) {
        .
        .
        .
        $sb_convert = $output;
        $sb_input =  array(&quot;&lt;&quot;,&quot;&gt;&quot;,&quot;(&quot;,&quot;)&quot;);
        $sb_output = array(&quot;&amp;lt;&quot;,&quot;&amp;gt;&quot;,&quot;&amp;#40;&quot;,&quot;&amp;#41;&quot;);
        $output = str_replace($sb_input, $sb_output, $sb_convert);
        return $title;
}


function get_the_content($more_link_text = &apos;(more...)&apos;, $stripteaser =
0, $more_file = &apos;&apos;) {
        .
        .
        .
        return $output;
}

replace for by function

function get_the_content($more_link_text = &apos;(more...)&apos;, $stripteaser =
0, $more_file = &apos;&apos;) {
        .
        .
        .
        $sb_convert = $output;
        $sb_input =  array(&quot;&lt;&quot;,&quot;&gt;&quot;,&quot;(&quot;,&quot;)&quot;);
        $sb_output = array(&quot;&amp;lt;&quot;,&quot;&amp;gt;&quot;,&quot;&amp;#40;&quot;,&quot;&amp;#41;&quot;);
        $output = str_replace($sb_input, $sb_output, $sb_convert);
        return $output;
}

============================================================
-- 
 SoulBlack - Security Research
 http://www.soulblack.com.ar</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-04-13 08:11:29 0000</bug_when>
            <thetext>Discussion @
http://wordpress.org/support/topic.php?id=30721

Apparently the authors can&apos;t reproduce the problem. Any Wordpress user wants to help reproducing it ?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-13 08:56:06 0000</bug_when>
            <thetext>Confirmed with 1.5_beta1.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>peter.westwood@ftwr.co.uk</who>
            <bug_when>2005-04-13 11:16:43 0000</bug_when>
            <thetext>Comments from upstream:
http://textdrive.com/pipermail/wp-hackers/2005-April/000530.html

Quote:
Eli Sarver wrote:
&gt; Has this been addressed?
&gt; 
&gt; http://soulblack.com.ar/repo/papers/wordpress_advisory.txt

This is someone looking for recognition by trying to identify a 
non-issue as a problem. WordPress is highly secure by default. Should 
you be worried about this? Not if you haven&apos;t been worried by the past 5 
years of blogging software or any other CMS in the world.

That said, I think a default feature restricting users lower than level 
8 to a known subset of HTML would be useful, and will be including a 
future release. A while back Mark Ghosh created the giant array that 
KSES needs to accomplish this, I&apos;m sure he (or I) still have it somewhere.

-- 
Matt Mullenweg</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-04-13 11:27:54 0000</bug_when>
            <thetext>I&apos;m a bit concerned wbout that comment:

=============
&gt; Owner logs on, sees a new draft, clicks on it to view, and has just lost 
&gt; his weblog.

That&apos;s pretty extreme. One person would have to invest a lot of time and 
technical knowledge to execute that kind of exploit for very little (one 
blog) payoff.

Additionally, if they do contain control (however they manage it, JS 
XMLhttprequest *might* work) then what? They log in, post a bunch of 
crap, hijack the blog for 20 minutes? Big deal. You should have backups, 
and they don&apos;t actually have any passwords (they only have md5&apos;d 
cookies). So the recovery, sure, would be a pain, but would be quick. 
Combine that with the minimal likely hood of this happening and I don&apos;t 
think this comes close to anything critical.
==============

What he says basically is that you don&apos;t need security if you aren&apos;t the USAF or the NASA, and if you get hacked, so what, you&apos;ve backups...

Let&apos;s wait a little and see if something comes out of this discussion.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-15 23:05:45 0000</bug_when>
            <thetext>Upstream still discussing what to do. Though the included file editor does not appear too smart security wise. Perhaps we should not install templates.php in the future?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-17 22:36:59 0000</bug_when>
            <thetext>Apparently discussion has ceased upstream without a fix. 

web-apps please advise.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>beu@gentoo.org</who>
            <bug_when>2005-04-20 09:31:09 0000</bug_when>
            <thetext>I&apos;m testing this out now and seeing how functional things are without the templates.php file, will keep you all apprised.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>beu@gentoo.org</who>
            <bug_when>2005-04-20 10:59:32 0000</bug_when>
            <thetext>wp-admin/templates.php is removed by the ebuild and installs a dummy templates.php that die()&apos;s informing the user of the reason and references this bug for more information.

Tested and marked stable on x86.  Arches, please test and mark stable.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>hansmi@gentoo.org</who>
            <bug_when>2005-04-20 12:02:34 0000</bug_when>
            <thetext>Stable on ppc.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>peter.westwood@ftwr.co.uk</who>
            <bug_when>2005-04-20 14:39:13 0000</bug_when>
            <thetext>Bug 82295  which was about including 1.5 noted that upgrade path from 1.2.2-&gt;1.5 is not simple.

Also current ebuild in cvs doesn&apos;t mark enough files as user configurable for multiple installs - e.g. anything in plugins and themes folders under wp-content for starters
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gustavoz@gentoo.org</who>
            <bug_when>2005-04-26 18:37:52 0000</bug_when>
            <thetext>sparc stable.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-04-27 00:36:21 0000</bug_when>
            <thetext>Ready for GLSA vote</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>beu@gentoo.org</who>
            <bug_when>2005-04-27 00:58:13 0000</bug_when>
            <thetext>Sorry to chime in on this so late (been having webapp-config and upstream issues), but this needs a new revision as disabling templates.php is not enough.  I&apos;ve worked on a bump, but it&apos;s getting hard as upstream is not helping me at all.

I will continue and bump wordpress again, however I would like to request that, before I do so, security@ seriously consider serurity masking www-apps/wordpress.  Upstream clearly doesn&apos;t regard security very highly, and quite frankly, upstream have been a nightmare with this and other security issues - extracting blood from an ant comes to mind.

Again, apologies for being late on this one.  Being stretched very thing here ;)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-04-27 01:04:11 0000</bug_when>
            <thetext>I don&apos;t want to waste more time on wordpress... I propose we mask it until upstream cares about security enough to patch those things.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-27 07:34:58 0000</bug_when>
            <thetext>I agree someone with magic commit rights please mask.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>beu@gentoo.org</who>
            <bug_when>2005-04-27 07:51:09 0000</bug_when>
            <thetext>Masked accordingly:

# Elfyn McBratney &lt;beu@gentoo.org&gt; (27 Apr 2005)
# Security mask, see bug #88926.
www-apps/wordpress
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-04-27 08:16:03 0000</bug_when>
            <thetext>Thx Elfyn.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoo-bugs@mccaleb.us</who>
            <bug_when>2005-05-03 09:44:46 0000</bug_when>
            <thetext>Perhaps a bit more information should be included in the mask?  As I understand it, this only affects sites with multiple authors that have posting access.  Those with only one author, or with only a core group of authors who are fully trusted shouldn&apos;t have need to fear this potential vulnerability.  

I agree that it should probably still be masked to protect the unwary, but perhaps the comment in /usr/portage/profiles/package.mask should direct users in the two cases I mentioned to feel free to unmask the file in /etc/portage/package.unmask?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-03 13:43:33 0000</bug_when>
            <thetext>It references this bug and comment #18 is a fine description.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>zwik@gmx.net</who>
            <bug_when>2005-05-10 06:33:26 0000</bug_when>
            <thetext>Everything should be fixed in the new 1.5.1 version.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-10 08:29:20 0000</bug_when>
            <thetext>The script issue seems to be solved, the iframe issue is not.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-05-21 02:17:18 0000</bug_when>
            <thetext>Apparently there also is SQL injection...

==============================================================
From: 	  bugtraq@morph3us.org
	Subject: 	[BuHa Security] Wordpress SQL-Injection
	Date: 	May 19, 2005 11:52:58 PM EDT
	To: 	  bugtraq@securityfocus.com



 ---------------------------------------------------
| BuHa Security-Advisory #1     |    May 17th, 2005 |
 ---------------------------------------------------
| Vendor   | Wordpress                              |
| URL      | http://wordpress.org/                  |
| Version  | &lt;= Wordpress 1.5                       |
| Risk     | Moderate (SQL-Injection)               |
 ---------------------------------------------------

o Description:
=============

WordPress is a state-of-the-art semantic personal publishing platform
with a focus on aesthetics, web standards, and usability. 

Visit http://wordpress.org/ for detailed information.

o SQL-Injection:
===============

The most critical vulnerability in the 1.5 release of wordpress is an
SQL-Injection in `wp-trackback.php&apos;. It&apos;s not easily exploitable
because you do not get a result when you inject a valid query but it&apos;s
possible to bruteforce values in the tables - for example the password
hashes.

Here some details:
The parameter `tb_id&apos; in `wp-trackback.php&apos; is not validated correctly
and there are no quotes in the SQL-query so an attacker is able to 
insert sql commands.

$pingstatus = $wpdb-&gt;get_var(&quot;SELECT ping_status FROM $wpdb-&gt;posts
WHERE ID = $tb_id&quot;);
	
Example: (I converted the POST-request into a GET-request.)

$tb_id = 1 union select user_pass,0 from wp_users
$url = bla
$title = bla

&lt;/wp-trackback.php?tb_id=1%20union%20select%200,user_pass%20from%20
wp_users&amp;url=bla&amp;title=bla&gt;

By injecting this query I get following databae error:

WordPress database error:
[The used SELECT statements have a different number of columns]
SELECT ping_status FROM wp_posts WHERE ID = 1 union select 0, 
user_pass from wp_users

When I insert &quot;1 union select user_pass from wp_users&quot; as value for
`tb_id&apos; I get no error message because the query was well-formed -
logical. Through the possibility to insert any sql-command it&apos;s
possible to &apos;reconstruct&apos; values of the tables.

o XSS:
=====

&lt;/wp-admin/edit.php?s=[XSS]&amp;submit=Search&gt;
&lt;/wp-admin/post.php?action=confirmdeletecomment&amp;comment=1&amp;p=[XSS]&gt;

o Path Disclosure:
=================

&lt;/wordpress-1.5-strayhorn/wp-content/themes/*&gt;
&lt;/wordpress-1.5-strayhorn/wp-includes/*&gt;
&lt;/wordpress-1.5-strayhorn/wp-admin/*&gt;

Fatal error: Call to undefined function add_filter() in
[...]/htdocs/testenv/blogs/wordpress/wordpress-1.5-strayhorn/
wp-content/themes/classic/comments-popup.php on line 3

o Disclosure Timeline:
=====================

17 Apr 05 - Security flaws discovered.
19 Apr 05 - Vendor contacted.
10 May 05 - Vendor released bugfixed version.
17 May 05 - Public release.

o Solution:
==========

Upgrade to wordpress 1.5.1 [1]

o Credits:
=========

Thomas Waldegger &lt;bugtraq@morph3us.org&gt;
BuHa-Security Community - http://buha.info/board/

[1] http://wordpress.org/development/2005/05/one-five-one/
=============================================================</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-05-21 02:18:04 0000</bug_when>
            <thetext>*** Bug 93355 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-05-21 02:18:48 0000</bug_when>
            <thetext>Back in main scope for discussion</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-22 22:37:23 0000</bug_when>
            <thetext>Release note for 1.5.1.1 does not mention a fix of the iframe issue. 
 
http://wordpress.org/development/2005/05/one-five-one/ 
 
Is the iframe issue also relevant for comments or only posts? </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>superlag@gentoo.org</who>
            <bug_when>2005-05-24 11:57:55 0000</bug_when>
            <thetext>Potential issues with PHP were having display_errors turned on in php.ini, which
goes against the advice of the PHP developers for use in a production
environment.  It would allow security info to be displayed that was unnecessary.

Also, iframe is only an issue if the blog admin gives a new user the rights to
publish and said user goes berserk and starts doing malicious things.  If the
admin keeps things locked down, this isn&apos;t an issue at all.  This can happen on
ANY platform if permissions are too loose.

There *have* been security issues found with users being able to reset admin
passwords, and the password would go back to the original ownser.  This issue
has been fixed in 1.5.1.1

Perhaps adding some einfo text is warranted, mentioning to users that they
should take care who they give privileges too, but this is common sense.

In my opinion, it should be bumped to 1.5.1.1 ASAP, and this can be removed from
package.mask and moved to ~.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-25 06:48:26 0000</bug_when>
            <thetext>I think 1.5.1.1 can be unmasked. webapps please bump if you agree.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>superlag@gentoo.org</who>
            <bug_when>2005-05-27 08:01:01 0000</bug_when>
            <thetext>ka0ttic said I could go ahead and bump.

Bumped to 1.5.1.2
Keyworded for all arches
removed from package.mask</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>superlag@gentoo.org</who>
            <bug_when>2005-05-27 08:09:14 0000</bug_when>
            <thetext>sorry guys... thought this was web-apps bug and not a security bug.  Reopening.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-05-27 08:21:05 0000</bug_when>
            <thetext>Thx SuperLag :)
Security: please vote on GLSA need, taking the masking history into account...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>superlag@gentoo.org</who>
            <bug_when>2005-05-27 08:36:04 0000</bug_when>
            <thetext>Marking stable for x86 and amd64.  They both work here.

PPC and Sparc teams, please mark stable.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vorlon@gentoo.org</who>
            <bug_when>2005-05-27 08:57:03 0000</bug_when>
            <thetext>Since this package has been masked before, I slightly tend to vote no. Since
it&apos;s just too hot in here atm to think... just count it as 0.5 votes against a
GLSA ;-)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-27 10:20:33 0000</bug_when>
            <thetext>I tend to vote YES, hopefully this will bode well for future releases. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-05-27 13:41:48 0000</bug_when>
            <thetext>I vote YES too...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-05-27 13:46:48 0000</bug_when>
            <thetext>superlag: apparently it&apos;s not been unmasked.

sparc, ppc: wordpress was marked stable before masking, please test 1.5.1.2 and
mark stable if possible</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>weeve@gentoo.org</who>
            <bug_when>2005-05-27 15:17:52 0000</bug_when>
            <thetext>Stable on SPARC.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>hansmi@gentoo.org</who>
            <bug_when>2005-05-28 12:57:05 0000</bug_when>
            <thetext>Stable on ppc.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-28 23:18:02 0000</bug_when>
            <thetext>This is ready for GLSA decision. 1</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-28 23:18:02 0000</bug_when>
            <thetext>This is ready for GLSA decision. 1½ YES and ½ NO so far. Please cast your 
vote. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-05-30 08:36:17 0000</bug_when>
            <thetext>I think we should release a GLSA for this bug and bug #94512 when fixed. </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>koon@gentoo.org</who>
            <bug_when>2005-06-01 00:49:14 0000</bug_when>
            <thetext>Ready for GLSA together with bug 94512</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jaervosz@gentoo.org</who>
            <bug_when>2005-06-06 13:53:14 0000</bug_when>
            <thetext>GLSA 200506-04 </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rjenster@eiszeit.blogdns.net</who>
            <bug_when>2005-11-30 15:58:34 0000</bug_when>
            <thetext>Does the vulnerability still exist on version 1.5.2? 
Ebuild still replaces template.php with the dummy template. 
 
http://forums.gentoo.org/viewtopic-p-2919254.html#2919254 </thetext>
          </long_desc>
      
    </bug>

</bugzilla>