<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A Note To Theme Authors About&#160;get_search_query()</title>
	<atom:link href="http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-note-to-theme-authors-about-get_search_query</link>
	<description>Random stuff written by Alex Mills</description>
	<lastBuildDate>Sat, 11 Feb 2012 01:00:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
	<item>
		<title>By: Darknet</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-230556</link>
		<dc:creator>Darknet</dc:creator>
		<pubDate>Sat, 24 Apr 2010 15:24:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-230556</guid>
		<description>Nice article, someone just reported an XSS in my site - it was the same issue the theme was just spitting out the search query raw as %s on the page which made it easily exploited.

Switched it to the_search_query() and I&#039;m safe again.

Thanks! Because the WP Codex information of these functions SUCKS.</description>
		<content:encoded><![CDATA[<p>Nice article, someone just reported an XSS in my site &#8211; it was the same issue the theme was just spitting out the search query raw as %s on the page which made it easily exploited.</p>
<p>Switched it to the_search_query() and I&#8217;m safe again.</p>
<p>Thanks! Because the WP Codex information of these functions SUCKS.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Viper007Bond</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-229368</link>
		<dc:creator>Viper007Bond</dc:creator>
		<pubDate>Sun, 27 Dec 2009 20:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-229368</guid>
		<description>At the time I wrote this post, &lt;code&gt;attribute_escape()&lt;/code&gt; was not deprecated. ;)</description>
		<content:encoded><![CDATA[<p>At the time I wrote this post, <code>attribute_escape()</code> was not deprecated. <img src='http://www.viper007bond.com/wordpress/wp-content/plugins/tango-smilies/tango/face-wink.png' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EW</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-229367</link>
		<dc:creator>EW</dc:creator>
		<pubDate>Sun, 27 Dec 2009 20:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-229367</guid>
		<description>the_search_query() is for outputting directly within the div body, e.g. wrapped by  tags in your example.

You would echo the results of esc_attr() or esc_attr_e() for elements &lt;b&gt;attributes&lt;/b&gt; (such as: an input value=&quot;&lt;i&gt;something&lt;/i&gt;&quot; attribute). See http://codex.wordpress.org/Function_Reference/attribute_escape for deprecation notice.</description>
		<content:encoded><![CDATA[<p>the_search_query() is for outputting directly within the div body, e.g. wrapped by  tags in your example.</p>
<p>You would echo the results of esc_attr() or esc_attr_e() for elements <b>attributes</b> (such as: an input value=&#8221;<i>something</i>&#8221; attribute). See <a href="http://codex.wordpress.org/Function_Reference/attribute_escape" rel="nofollow">http://codex.wordpress.org/Function_Reference/attribute_escape</a> for deprecation notice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Le référencement local, les résultats personnalisés et une faille XSS &#124; Pink Seo &#8211; Another SEO blog</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-229219</link>
		<dc:creator>Le référencement local, les résultats personnalisés et une faille XSS &#124; Pink Seo &#8211; Another SEO blog</dc:creator>
		<pubDate>Sun, 13 Dec 2009 21:29:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-229219</guid>
		<description>[...] où la fonction get_search_query() était utilisé. En remplaçant par the_search_query() comme expliqué ici résoud le problème. Donc attention avant d&#8217;installer un thème sur votre blog, même si [...]</description>
		<content:encoded><![CDATA[<p>[...] où la fonction get_search_query() était utilisé. En remplaçant par the_search_query() comme expliqué ici résoud le problème. Donc attention avant d&#8217;installer un thème sur votre blog, même si [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ma revue de la semaine &#124; 360 e-media</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-229128</link>
		<dc:creator>Ma revue de la semaine &#124; 360 e-media</dc:creator>
		<pubDate>Sun, 06 Dec 2009 18:45:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-229128</guid>
		<description>[...] à WordPress, si ces problèmatiques vous intéressent, voici quelques liens intéressants : ici, et ici. (et puis tant que j&#8217;y suis, un lien vers un support de cours sur la sécurisation [...]</description>
		<content:encoded><![CDATA[<p>[...] à WordPress, si ces problèmatiques vous intéressent, voici quelques liens intéressants : ici, et ici. (et puis tant que j&#8217;y suis, un lien vers un support de cours sur la sécurisation [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Viper007Bond</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-227553</link>
		<dc:creator>Viper007Bond</dc:creator>
		<pubDate>Fri, 08 May 2009 13:24:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-227553</guid>
		<description>[quote comment=&quot;227552&quot;]Viper: why did you pass through attribute_escape() instead of wp_specialchars()? Wouldn&#039;t that be a more appropriate choice for text destined to be displayed in the page? Does the extra invalid UTF check give any extra protection for this case?[/quote]

Probably, but they&#039;re very similar (I believe both are just complex versions of &lt;code&gt;htmlspecialchars()&lt;/code&gt;). I just stole the code I posted though out of &lt;code&gt;the_search_query()&lt;/code&gt; which is mainly meant for the search form (i.e. filling in the search box with the term you searched for).</description>
		<content:encoded><![CDATA[<p><a href="http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-227552">Dougal Campbell on May 8th, 2009 at 5:51 AM wrote:</a></p>
<blockquote><p>Viper: why did you pass through attribute_escape() instead of wp_specialchars()? Wouldn&#8217;t that be a more appropriate choice for text destined to be displayed in the page? Does the extra invalid UTF check give any extra protection for this case?</p></blockquote>
<p>Probably, but they&#8217;re very similar (I believe both are just complex versions of <code>htmlspecialchars()</code>). I just stole the code I posted though out of <code>the_search_query()</code> which is mainly meant for the search form (i.e. filling in the search box with the term you searched for).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dougal Campbell</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-227552</link>
		<dc:creator>Dougal Campbell</dc:creator>
		<pubDate>Fri, 08 May 2009 12:51:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-227552</guid>
		<description>[quote post=&quot;900&quot;]So when you’re saying it’s not sanitized, I’m guessing that you’re saying that it’s susceptible to SQL injection? [/quote]

He&#039;s just saying that the function returns the raw value, just as it was passed into WordPress, and you can&#039;t trust it. Otherwise, if you just echo it back to the browser without sanitizing it yourself, you could be opening up an XSS hole (cross-site scripting). Somebody could make a link elsewhere with evil code in it which could steal an unsuspecting visitor&#039;s cookies, under the right conditions (the user has cookies from your blog, and they get tricked into clicking the evil link on some other site).

Viper: why did you pass through attribute_escape() instead of wp_specialchars()? Wouldn&#039;t that be a more appropriate choice for text destined to be displayed in the page? Does the extra invalid UTF check give any extra protection for this case?</description>
		<content:encoded><![CDATA[<blockquote><p>So when you’re saying it’s not sanitized, I’m guessing that you’re saying that it’s susceptible to SQL injection? </p></blockquote>
<p>He&#8217;s just saying that the function returns the raw value, just as it was passed into WordPress, and you can&#8217;t trust it. Otherwise, if you just echo it back to the browser without sanitizing it yourself, you could be opening up an XSS hole (cross-site scripting). Somebody could make a link elsewhere with evil code in it which could steal an unsuspecting visitor&#8217;s cookies, under the right conditions (the user has cookies from your blog, and they get tricked into clicking the evil link on some other site).</p>
<p>Viper: why did you pass through attribute_escape() instead of wp_specialchars()? Wouldn&#8217;t that be a more appropriate choice for text destined to be displayed in the page? Does the extra invalid UTF check give any extra protection for this case?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Viper007Bond</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-227491</link>
		<dc:creator>Viper007Bond</dc:creator>
		<pubDate>Tue, 28 Apr 2009 02:04:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-227491</guid>
		<description>[quote comment=&quot;227487&quot;]So when you&#039;re saying it&#039;s not sanitized, I&#039;m guessing that you&#039;re saying that it&#039;s susceptible to SQL injection?[/quote]

No, I mean if a user visits &lt;code&gt;site.com/?s=&lt;script&gt;alert(&#039;hi&#039;)&lt;script&gt;&lt;/code&gt; you&#039;ll get a Javascript alert box. It&#039;s not escaped HTML entity wise.

the_search_query() is, but it echoes rather than returning.</description>
		<content:encoded><![CDATA[<p><a href="http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-227487">Kevin on April 27th, 2009 at 6:25 AM wrote:</a></p>
<blockquote><p>So when you&#8217;re saying it&#8217;s not sanitized, I&#8217;m guessing that you&#8217;re saying that it&#8217;s susceptible to SQL injection?</p></blockquote>
<p>No, I mean if a user visits <code>site.com/?s=&lt;script&gt;alert('hi')&lt;script&gt;</code> you&#8217;ll get a Javascript alert box. It&#8217;s not escaped HTML entity wise.</p>
<p>the_search_query() is, but it echoes rather than returning.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://www.viper007bond.com/2009/04/15/a-note-to-theme-authors-about-get_search_query/comment-page-1/#comment-227487</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Mon, 27 Apr 2009 13:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.viper007bond.com/?p=900#comment-227487</guid>
		<description>So when you&#039;re saying it&#039;s not sanitized, I&#039;m guessing that you&#039;re saying that it&#039;s susceptible to SQL injection? 

I just checked the codex page and it&#039;s really sparse on any information and appears to suggest that the_search_query() and get_search_query() are synonymous. Any chance you&#039;d be willing to edit the codex page? I was going to paste in your post, but I didn&#039;t want to be presumptuous.
http://codex.wordpress.org/Function_Reference/get_search_query

Searched the themes in my wpmu install and none of our production themes use the function, but I did see that K2 does which I know comes with the Farms 100 pack.</description>
		<content:encoded><![CDATA[<p>So when you&#8217;re saying it&#8217;s not sanitized, I&#8217;m guessing that you&#8217;re saying that it&#8217;s susceptible to SQL injection? </p>
<p>I just checked the codex page and it&#8217;s really sparse on any information and appears to suggest that the_search_query() and get_search_query() are synonymous. Any chance you&#8217;d be willing to edit the codex page? I was going to paste in your post, but I didn&#8217;t want to be presumptuous.<br />
<a href="http://codex.wordpress.org/Function_Reference/get_search_query" rel="nofollow">http://codex.wordpress.org/Function_Reference/get_search_query</a></p>
<p>Searched the themes in my wpmu install and none of our production themes use the function, but I did see that K2 does which I know comes with the Farms 100 pack.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

