<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6350603375912746078</id><updated>2012-01-31T14:57:20.435-08:00</updated><category term='referer'/><category term='xss'/><category term='persistent xss'/><category term='link injection'/><title type='text'>Fat Programming</title><subtitle type='html'>Web development and MOAR :]</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mattiaalfieri.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mattiaalfieri.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mattia Alfieri</name><uri>https://profiles.google.com/112343390017713445526</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-ksJcmCIMfGM/AAAAAAAAAAI/AAAAAAAAALg/bKff1JNLe-M/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6350603375912746078.post-1759357556226896965</id><published>2011-04-26T04:28:00.001-07:00</published><updated>2011-05-04T06:30:58.783-07:00</updated><title type='text'>Pretending multiple runtime inheritance in php 5.X</title><content type='html'>Sometimes you REALLY need something that your programming language doesn't offers. Maybe because your programming language is obsolete, or because it offers you a different solution to the same problem, but you don't like this alternative solution.&lt;br /&gt;&lt;br /&gt;Here i will discuss about &lt;span style="font-weight:bold;"&gt;how to&lt;/span&gt; implement multiple inheritance in php, not why, just how. Most of the times, if you need multiple inheritance in your classes, you could be able to &lt;a href="http://stackoverflow.com/questions/90982/multiple-inheritance-in-php"&gt;solve the problem without it&lt;/a&gt; but HEY where's the fun?&lt;br /&gt;&lt;br /&gt;Here's &lt;a href="https://gist.github.com/942406"&gt;my implementation&lt;/a&gt; of an abstract class that you can extend in order to define your class that will need runtime inheritance-like funcitonalities.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid #eee; padding:10px; font-size:12px; background-color: #fafafa; color:black;"&gt;&amp;lt;?php&lt;br /&gt;class Pirate&lt;br /&gt;{&lt;br /&gt;public function doPirateStuff()&lt;br /&gt;{&lt;br /&gt;echo "YARRRRRRRR I SINK SHIPS!";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Cyborg&lt;br /&gt;{&lt;br /&gt;public function doCyborgStuff()&lt;br /&gt;{&lt;br /&gt;echo "I DESTROY HUMANS";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Ninja&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public function doNinjaStuff()&lt;br /&gt;{&lt;br /&gt;echo "I SLICE AND DICE";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class SUPERHERO extends MultipleInheritant&lt;br /&gt;{&lt;br /&gt;public function __construct($name)&lt;br /&gt;{&lt;br /&gt;echo "I AM $name THE NEW SUPERHERO IN TOWN";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$s = new SUPERHERO('FATMAN');&lt;br /&gt;$s-&amp;gt;inherit('Ninja');&lt;br /&gt;$s-&amp;gt;inherit('Pirate');&lt;br /&gt;$s-&amp;gt;inherit('Cyborg');&lt;br /&gt;$s-&amp;gt;doCyborgStuff();&lt;br /&gt;$s-&amp;gt;doPirateStuff();&lt;br /&gt;$s-&amp;gt;doNinjaStuff();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The output for this, is:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px solid #eee; padding:10px; font-size:12px; background-color: #fafafa; color:black;"&gt;I AM FATMAN THE NEW SUPERHERO IN TOWN&lt;br /&gt;I DESTROY HUMANS&lt;br /&gt;YARRRRRRRR I SINK SHIPS!&lt;br /&gt;I SLICE AND DICE&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6350603375912746078-1759357556226896965?l=mattiaalfieri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattiaalfieri.blogspot.com/feeds/1759357556226896965/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://mattiaalfieri.blogspot.com/2011/04/pretending-multiple-runtime-inheritance.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default/1759357556226896965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default/1759357556226896965'/><link rel='alternate' type='text/html' href='http://mattiaalfieri.blogspot.com/2011/04/pretending-multiple-runtime-inheritance.html' title='Pretending multiple runtime inheritance in php 5.X'/><author><name>Mattia Alfieri</name><uri>https://profiles.google.com/112343390017713445526</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-ksJcmCIMfGM/AAAAAAAAAAI/AAAAAAAAALg/bKff1JNLe-M/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6350603375912746078.post-5964999015870733191</id><published>2009-12-25T10:16:00.000-08:00</published><updated>2009-12-25T12:06:19.490-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='referer'/><category scheme='http://www.blogger.com/atom/ns#' term='link injection'/><title type='text'>Threats behind Wordpress.com: Link Injection</title><content type='html'>I am an enthusiastic ownerof a Wordpress.com blog, and those of you who use thath blogging platform like me would admit the utility of the stat counter. Infact it provides you a pretty detailed record of in/out http traffic of your blog: search engine keywords, most viewed articles, (...) and &lt;span style="font-weight: bold;"&gt;referer&lt;/span&gt;s. Most of you could have already guessed what i'm going to tell you, but let's explain a bit what referer is.&lt;br /&gt;&lt;br /&gt;When you browse the web, even if this is completely transparent to (most of )users, there is a continuos exchange of meta data between your web browser and the server in which the website is hosted. Tecnically speaking, browser and server send and receive requests. These requests contain headers: fields defining characteristic of the sent data, in particular &lt;span style="font-weight: bold;"&gt;the referer contains the url of the previous web page from which a link led the user to the current page&lt;/span&gt;.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HvLo1r4wS-I/SzUabCs8k_I/AAAAAAAAAEY/UZ5E3VvoZuY/s1600-h/referer.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 203px;" src="http://4.bp.blogspot.com/_HvLo1r4wS-I/SzUabCs8k_I/AAAAAAAAAEY/UZ5E3VvoZuY/s320/referer.JPG" alt="" id="BLOGGER_PHOTO_ID_5419266778494440434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this way the referer tell us which pages are currently linking to our weblog so we can check who's talking about us.&lt;br /&gt;&lt;br /&gt;Beyond this advantage there is a big pitfall: Storing and showing the referer expose the application to potential threats such as Cross Site Scripting and more silently to an unusual threat that i decided to call Link Injection (I say that "I decided" because i have not found any literature about this kind of issue yet).&lt;br /&gt;&lt;br /&gt;Wordpress.com seems to filter user input properly to protect users against XSS and code injection, but it does not provide any protection against link injection!&lt;br /&gt;&lt;br /&gt;HTTP Referer can be easily modifyed : I used to do with the firefox extension &lt;a href="https://addons.mozilla.org/it/firefox/addon/967"&gt;Modify Headers&lt;/a&gt; or with the fantastic &lt;a href="http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project"&gt;Webscarab&lt;/a&gt; a powerful framework from OWASP; the easiness of this attack makes its power, here's a possible scenario:&lt;br /&gt;&lt;br /&gt;The attacker knows the url of victim's blog, so he write a script to send http requests on it. Let's say that the victim's blog is not very popular so a dozen visits to his blog from the same source could make him curious; the attacker knows that, or maybe he decide the number of requests to send by probabilistic considerations. In this way the victim will follow the injected link . That link could represent an infected page or something else.&lt;br /&gt;&lt;br /&gt;&lt;span id="result_box" class="short_text"&gt;&lt;span style="background-color: rgb(255, 255, 255);" title="purtroppo"&gt;Unfortunately &lt;/span&gt;&lt;/span&gt;there isn't an easy way to avoid this kind of threat without compromise the efficiency of the service, personally i would remove the anchor tag from referers and i'd put a little "Warning" near them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6350603375912746078-5964999015870733191?l=mattiaalfieri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattiaalfieri.blogspot.com/feeds/5964999015870733191/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://mattiaalfieri.blogspot.com/2009/12/threats-behind-wordpresscom-link.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default/5964999015870733191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default/5964999015870733191'/><link rel='alternate' type='text/html' href='http://mattiaalfieri.blogspot.com/2009/12/threats-behind-wordpresscom-link.html' title='Threats behind Wordpress.com: Link Injection'/><author><name>Mattia Alfieri</name><uri>https://profiles.google.com/112343390017713445526</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-ksJcmCIMfGM/AAAAAAAAAAI/AAAAAAAAALg/bKff1JNLe-M/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_HvLo1r4wS-I/SzUabCs8k_I/AAAAAAAAAEY/UZ5E3VvoZuY/s72-c/referer.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6350603375912746078.post-2423505064238670131</id><published>2009-12-24T04:55:00.000-08:00</published><updated>2009-12-24T05:25:38.811-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='referer'/><category scheme='http://www.blogger.com/atom/ns#' term='xss'/><category scheme='http://www.blogger.com/atom/ns#' term='persistent xss'/><title type='text'>Insecurity Of Referer checking services</title><content type='html'>I recently wrote on my &lt;a href="http://fatmatt.wordpress.com"&gt;italian speaking blog&lt;/a&gt; about insecurity of referer viewing services. In particular i wrote about &lt;a href="http://fatmatt.wordpress.com/2009/12/23/le-insidie-di-wordpress-com/"&gt;link injection on wordpress.com&lt;/a&gt; administration page (maybe i will translate it in this blog). From that article i started thinking about : How bad guys could use this vulnerabilty to threat good guys? I had a first answer googling!&lt;br /&gt;&lt;br /&gt;The second link i get from google searching "show your referer" is wwwDOTshowskyDOTcom (i dont want to link it because it may fuck up you browser). That site shows your referer, WOW what a miracle of scripting, but it also Store latests referer, without filtering input, this means &lt;span style="font-weight: bold;"&gt;Persistent XSS&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;While i am writing this  lines, surfing that site means be greeted by a few alert('xss'), but i don't know what could become in the future :)&lt;br /&gt;&lt;br /&gt;This is a perfect example of "too much trust on user" and lack of input filtering.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6350603375912746078-2423505064238670131?l=mattiaalfieri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattiaalfieri.blogspot.com/feeds/2423505064238670131/comments/default' title='Commenti sul post'/><link rel='replies' type='text/html' href='http://mattiaalfieri.blogspot.com/2009/12/insecurity-of-referer-checking-services.html#comment-form' title='0 Commenti'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default/2423505064238670131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6350603375912746078/posts/default/2423505064238670131'/><link rel='alternate' type='text/html' href='http://mattiaalfieri.blogspot.com/2009/12/insecurity-of-referer-checking-services.html' title='Insecurity Of Referer checking services'/><author><name>Mattia Alfieri</name><uri>https://profiles.google.com/112343390017713445526</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh5.googleusercontent.com/-ksJcmCIMfGM/AAAAAAAAAAI/AAAAAAAAALg/bKff1JNLe-M/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
