<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Oggetto</title>
    <description>The latest articles on DEV Community by Oggetto (@oggetto).</description>
    <link>https://dev.to/oggetto</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F722882%2F92cb6468-2306-40e2-aca6-846b0cbaa99d.png</url>
      <title>DEV Community: Oggetto</title>
      <link>https://dev.to/oggetto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oggetto"/>
    <language>en</language>
    <item>
      <title>FiveM RAT Analysis</title>
      <dc:creator>Oggetto</dc:creator>
      <pubDate>Sun, 11 Aug 2024 09:37:01 +0000</pubDate>
      <link>https://dev.to/oggetto/fivem-rat-analysis-2ndb</link>
      <guid>https://dev.to/oggetto/fivem-rat-analysis-2ndb</guid>
      <description>&lt;h2&gt;
  
  
  Analyzing the FiveM RAT: A Comprehensive Overview
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;A few months ago, I published a repository detailing the analysis of a Remote Access Trojan (RAT) discovered in multiple FiveM server resources so I decided to make a blog post about that.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Warning: The code discussed in this post is malicious and should not be used under any circumstances. This analysis is provided strictly for educational purposes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  RAT Features
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://github.com/JustOptimize/FiveM-RAT-Analysis/tree/main/RCE" rel="noopener noreferrer"&gt;Remote Code Execution (RCE)&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The RAT operates through multiple stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Stage 1:&lt;/strong&gt; Downloads the second stage from a remote server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 2:&lt;/strong&gt; Continues by fetching the third stage from the server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 3:&lt;/strong&gt; Retrieves the fourth stage, maintaining the infection process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 4:&lt;/strong&gt; Establishes a persistent connection with the remote server, awaiting further commands.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://github.com/JustOptimize/FiveM-RAT-Analysis/tree/main/BSC" rel="noopener noreferrer"&gt;Between Script Communication (BSC)&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The RAT also registers handlers for events triggered by other RAT instances, allowing it to bypass detection by communicating between scripts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Findings
&lt;/h3&gt;

&lt;p&gt;During a deeper investigation into an infected VPS, I discovered that the hosts file had been modified to block access to many common antivirus websites. This was likely done to prevent the server from being scanned and detected by antivirus software.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prevention Strategies
&lt;/h3&gt;

&lt;p&gt;To protect your server from such threats, consider the following measures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Avoid Downloading Leaked Resources:&lt;/strong&gt; Only use trusted sources for server resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep Your Server Updated:&lt;/strong&gt; Regular updates can patch vulnerabilities that may be exploited by attackers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement a Firewall:&lt;/strong&gt; A firewall can block unauthorized access to your server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a Web Application Firewall (WAF):&lt;/strong&gt; WAFs provide an additional layer of protection for web applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install Reliable Antivirus Software:&lt;/strong&gt; Ensure your server is equipped with strong antivirus protection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor for Suspicious Activity:&lt;/strong&gt; Regularly check your server for any unusual behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review Your Resources:&lt;/strong&gt; Periodically inspect the code in your resources for any suspicious modifications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Mitigation Measures
&lt;/h3&gt;

&lt;p&gt;After identifying the RAT, I implemented several mitigation steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;IP Blocking:&lt;/strong&gt; I added the IP address of the malicious server to the firewall blacklist, cutting off communication with the RAT's host.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain Blocking:&lt;/strong&gt; The RAT's domain was blocked in the hosts file, preventing it from communicating with the remote server even if the IP address was changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Removal:&lt;/strong&gt; The malicious code was deleted from the affected resources, and the server was restarted to halt further execution.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Recent Developments
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;March 28, 2024:&lt;/strong&gt; The first instance of this RAT was discovered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;March 29, 2024:&lt;/strong&gt; A second instance was found, using a different domain for its backdoor: thedreamoffivem[.]com &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By staying vigilant and employing strong security practices, you can help protect your FiveM server from similar threats.&lt;/p&gt;

</description>
      <category>lua</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Tables SUCK and this is WHY</title>
      <dc:creator>Oggetto</dc:creator>
      <pubDate>Mon, 06 Nov 2023 22:22:42 +0000</pubDate>
      <link>https://dev.to/oggetto/tables-suck-and-this-is-why-4cje</link>
      <guid>https://dev.to/oggetto/tables-suck-and-this-is-why-4cje</guid>
      <description>&lt;p&gt;Hi everyone after a WEEK of debugging code I found out that assigning a table to a variable in lua, js, ruby and many other languages creates a reference to the original table instead of creating a copy.&lt;/p&gt;

&lt;p&gt;This means that every time you edit the new variable it actually edits the original table.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can I create a copy? (Lua)
&lt;/h2&gt;

&lt;p&gt;To actually create a copy you need to do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="n"&gt;myTable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;pairs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myOtherTable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;myTable&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;PS: Please note that this will create shallow copies, which means only the top-level elements will be copied. If the original table contains nested tables (subtables), those subtables will still be referenced by both the original and the copied table.&lt;/p&gt;

&lt;h3&gt;
  
  
  In my case
&lt;/h3&gt;

&lt;p&gt;This occurs even when saving a subtable so even with something like &lt;code&gt;local myTable = myOtherTable[a][b]&lt;/code&gt; will reference the table and not copy it&lt;/p&gt;

&lt;p&gt;REMEMBER THIS, don't be like me and spend more than 10 hours on something as stupid as this.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>testing</category>
      <category>coding</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Toggle God Mode in browsers</title>
      <dc:creator>Oggetto</dc:creator>
      <pubDate>Sun, 10 Oct 2021 13:41:37 +0000</pubDate>
      <link>https://dev.to/oggetto/toggle-god-mode-in-browsers-2l16</link>
      <guid>https://dev.to/oggetto/toggle-god-mode-in-browsers-2l16</guid>
      <description>&lt;p&gt;Instead of typing&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;document.designMode = "on"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;document.designMode = "off"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;in the console for every page you want to edit (like this)&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv21hk4djggd5ghaimftj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv21hk4djggd5ghaimftj.gif" alt="Edit Manually" width="480" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can create a bookmark to toggle it with just one click!&lt;/p&gt;

&lt;p&gt;To make this it's easy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Right click on your bookmark bar&lt;/li&gt;
&lt;li&gt;Click add page&lt;/li&gt;
&lt;li&gt;Name it whatever you want&lt;/li&gt;
&lt;li&gt;And just paste this in the link section:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;javascript&lt;/span&gt;&lt;span class="p"&gt;:((&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;!==&lt;/span&gt;&lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;&lt;span class="nx"&gt;o&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;off&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;on&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;designMode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>chrome</category>
      <category>devtools</category>
      <category>webdev</category>
      <category>designmode</category>
    </item>
  </channel>
</rss>
