<?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: PhantomThreads</title>
    <description>The latest articles on DEV Community by PhantomThreads (@phantomthreads).</description>
    <link>https://dev.to/phantomthreads</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%2F1476382%2F49e0b203-f5c6-4012-8ec0-a6327c70c893.jpg</url>
      <title>DEV Community: PhantomThreads</title>
      <link>https://dev.to/phantomthreads</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phantomthreads"/>
    <language>en</language>
    <item>
      <title>Introduction to Frida for Reverse Engineering</title>
      <dc:creator>PhantomThreads</dc:creator>
      <pubDate>Sun, 26 May 2024 16:57:22 +0000</pubDate>
      <link>https://dev.to/phantomthreads/introduction-to-frida-for-reverse-engineering-1gc9</link>
      <guid>https://dev.to/phantomthreads/introduction-to-frida-for-reverse-engineering-1gc9</guid>
      <description>&lt;p&gt;Introduction to Frida for Reverse Engineering&lt;/p&gt;

&lt;p&gt;Frida is a dynamic instrumentation toolkit widely used in the realm of reverse engineering, security research, and application testing. It allows researchers and developers to inject their own scripts into running processes to analyze and manipulate their behavior at runtime. This powerful capability is invaluable for understanding how software works, identifying vulnerabilities, or bypassing certain restrictions without modifying the actual binary, which is especially useful in closed or proprietary systems.&lt;/p&gt;

&lt;p&gt;Benefits of Using Frida for Reverse Engineering&lt;/p&gt;

&lt;p&gt;Frida supports various platforms including Windows, Linux, macOS, iOS, Android, and QNX. This cross-platform support is crucial for analyzing applications that are available on multiple platforms.&lt;/p&gt;

&lt;p&gt;Frida works by attaching to existing processes or by spawning new processes. It doesn't require any changes to the binary itself, which makes it an ideal tool for analyzing production binaries.&lt;/p&gt;

&lt;p&gt;Frida uses JavaScript (or TypeScript) for scripting, which is easy to write and understand. This lowers the barrier to entry and allows for rapid prototyping and deployment of complex hooks and manipulations.&lt;/p&gt;

&lt;p&gt;Frida provides a rich API that allows deep manipulation and monitoring capabilities. This includes accessing memory, intercepting function calls, modifying registers, and calling native functions dynamically.&lt;/p&gt;

&lt;p&gt;There is a vibrant community around Frida, which contributes to a large repository of scripts and extensions. This ecosystem makes it easier to find solutions or get help for specific problems.&lt;/p&gt;

&lt;p&gt;Advanced Examples of Using Frida for Reverse Engineering&lt;/p&gt;

&lt;p&gt;Example 1: Intercepting and Modifying Function Arguments&lt;/p&gt;

&lt;p&gt;Suppose you're analyzing a proprietary encryption function within an Android app, and you want to see the data being passed to this function. You can use Frida to intercept the function call, log the arguments, and even modify them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;perform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;TargetClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;com.example.app.EncryptionUtils&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;TargetClass&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;encrypt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;implementation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Original data: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Modify the argument&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;modifiedData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;modified_&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Modified data: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;modifiedData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Continue with modified data&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;modifiedData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script changes the data being encrypted, which can be useful for testing how the application handles unexpected inputs or for bypassing security checks.&lt;/p&gt;

&lt;p&gt;Bypassing SSL Pinning on iOS&lt;/p&gt;

&lt;p&gt;SSL pinning is a security measure used to mitigate man-in-the-middle attacks by validating the server's certificate against a known good copy embedded in the application. Frida can be used to bypass this by intercepting the relevant SSL checks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ObjC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ObjC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mainQueue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;NSURLSessionDelegate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ObjC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;protocols&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NSURLSessionDelegate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Override the method that validates the server trust&lt;/span&gt;
    &lt;span class="nx"&gt;Interceptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ObjC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;YourAppClass&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;- validateServerTrust:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;implementation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;onEnter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Log the server trust validation attempt&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Server trust validation function called&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

            &lt;span class="c1"&gt;// Always return true for the validation result&lt;/span&gt;
            &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;ptr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0x1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script forces the validation function to always return &lt;code&gt;true&lt;/code&gt;, effectively bypassing SSL pinning.&lt;/p&gt;

&lt;p&gt;Dynamic Analysis of a Windows Application&lt;/p&gt;

&lt;p&gt;Suppose you want to trace the usage of a particular Windows API within an application to understand how it interacts with the system. Frida makes it easy to hook these API calls and log their parameters and results.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;kernel32&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kernel32.dll&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;createFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findExportByName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kernel32.dll&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;CreateFileW&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;Interceptor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;createFile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;onEnter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;readUtf16String&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CreateFile called with path: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;onLeave&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;retval&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;retval&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;File opened successfully&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Failed to open file&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script hooks the &lt;code&gt;CreateFileW&lt;/code&gt; function in &lt;code&gt;kernel32.dll&lt;/code&gt;, logs the file paths being accessed, and reports on whether the file open operation was successful.&lt;/p&gt;

&lt;p&gt;Some Android scripting examples:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Script to bypass root detection:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;perform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;targetClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;com.example.RootDetectionClass&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;targetClass&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isRooted&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;implementation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bypassing root detection...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Always return false to bypass root detection&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Script to hook and decrypt encrypted strings:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;perform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;targetClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;com.example.EncryptionClass&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;targetClass&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;decryptString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;java.lang.String&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;implementation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;encryptedString&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;decryptedString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decryptString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;encryptedString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Encrypted String: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;encryptedString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Decrypted String: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;decryptedString&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;decryptedString&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Script to bypass SSL pinning:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;perform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;CertificatePinner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Java&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;okhttp3.CertificatePinner&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;CertificatePinner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;check&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;java.lang.String&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="s1"&gt;java.util.List&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;implementation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;certificates&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bypassing SSL pinning for hostname: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;// Do nothing to bypass SSL pinning&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to replace the class names (&lt;code&gt;com.example.RootDetectionClass&lt;/code&gt;, &lt;code&gt;com.example.EncryptionClass&lt;/code&gt;) and method names with the appropriate ones from the target application you are analyzing. These scripts are just examples and may need to be adjusted based on the actual code you are reverse engineering.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Frida is an exceptionally versatile tool for reverse engineering, offering the ability to inspect, modify, and bypass the internal workings of a software application dynamically across multiple platforms. By understanding and utilizing Frida's capabilities through scripts like the examples provided, researchers and developers can gain deep insights into software behavior, enhance security testing, and even develop patches or enhancements for existing applications.&lt;/p&gt;

</description>
      <category>frida</category>
    </item>
    <item>
      <title>Ubuntu 24.04 Rufus Persistence</title>
      <dc:creator>PhantomThreads</dc:creator>
      <pubDate>Fri, 24 May 2024 20:45:47 +0000</pubDate>
      <link>https://dev.to/phantomthreads/ubuntu-2404-rufus-persistence-3oml</link>
      <guid>https://dev.to/phantomthreads/ubuntu-2404-rufus-persistence-3oml</guid>
      <description>&lt;p&gt;Rufus Fixes Creation of Persistent Ubuntu 24.04 USBs&lt;/p&gt;

&lt;p&gt;Rufus, a popular open-source tool for making bootable USB drives on Windows, just released an update that includes a ‘fix’ for working with Ubuntu 24.04 LTS ISOs.&lt;/p&gt;

&lt;p&gt;A truly versatile tool, Rufus is able to create bootable Windows installers from ISO files and disk images as well as Linux installers and, more pertinent to this news, persistent Ubuntu, Linux Mint, and Debian USB installers.&lt;/p&gt;

&lt;p&gt;Rufus 4.5, released this week, includes support for persistence in Ubuntu 24.04 LTS. Additionally, this update also fixes issues when creating persistent Linux Mint 21.x USBs too.&lt;/p&gt;

&lt;p&gt;Rufus 4.5 fixes persistent Ubuntu USBs &lt;br&gt;
Creating persistent Ubuntu USBs in Rufus isn’t new (the feature debuted in 2019) but its devs often have to play catchup as distros rename, update, or alter the various files needed to enable this feature.&lt;/p&gt;

&lt;p&gt;What is a persistent Linux USB?&lt;/p&gt;

&lt;p&gt;A way creating a bootable, portable installation without actually installing it. The ISO boots into a live session (as a USB installer would) but persistence adds a “casper-rw” file/partition (in Ubuntu) where files, settings, apps, etc., are stored.&lt;/p&gt;

&lt;p&gt;A live Linux USB installer boots a pristine version of OS each time and while you can use the live session like a real install (add apps, edit settings, etc) but all changes you make during the live session are lost when you shutdown.&lt;/p&gt;

&lt;p&gt;On a persistent Linux USB those changes persist between boots.&lt;/p&gt;

&lt;p&gt;Overlap with, say, creating a USB installation (i.e., using an installer to install the distro to the USB drive properly, and then booting that USB on other systems) exists.&lt;/p&gt;

&lt;p&gt;But persistent installers have their pluses: reduced overhead and they take up less space than a full, unpacked installation to disk. Plus, USB installations may end up tailored to specific hardware, affecting portability.&lt;/p&gt;

&lt;p&gt;And it’s easy to ‘reset’ the install without having to rewrite, reformat, or reinstall – just clean out the persistent storage section. In certain circumstances, that makes them better suited to ad-hoc testing.&lt;/p&gt;

&lt;p&gt;Persistent Ubuntu 24.04 USB has drawbacks: no Wayland; no user accounts; slower startup/shutdown; can’t switch session; and the Flutter installer will spawn on every boot.&lt;/p&gt;

&lt;p&gt;What’s New in Rufus 4.5?&lt;br&gt;
Since I’m here talking about the update I’ll list the other changes in Rufus 4.5.x release — most aren’t related to Ubuntu so don’t chide me for it in the comments for it, okay ;)&lt;/p&gt;

&lt;p&gt;Option to perform runtime UEFI media validation for Windows &amp;amp; Linux ISOs&lt;br&gt;
Fixes with/writing VHD/VHDX images&lt;br&gt;
Use Rufus MBR advanced option moved to ‘cheat mode’ panel&lt;br&gt;
Fix support for Linux persistence in Linux Mint &amp;amp; Ubuntu 24.04 LTS&lt;br&gt;
Security vulnerability patches&lt;br&gt;
Internal GRUB bumped to v2.12&lt;br&gt;
UEFI:NTFS updated + now uses ntfs-3g driver&lt;br&gt;
Buffer size when copying ISO files increased&lt;br&gt;
Improve partition creation/handling&lt;br&gt;
If you’re looking for a powerful, open-source tool for creating bootable USBs on Windows, with advanced options then Rufus is worth checking out or at least making a mental note of for possible future needs/recommendations.&lt;/p&gt;

&lt;p&gt;Among its most popular feature: the ability to create a Windows 11 USB installer using the official Windows 11 ISO but configured to bypass many of the hardcoded requirements which prevent users from installing it on “unsupported” hardware.&lt;/p&gt;

&lt;p&gt;Nifty, eh?&lt;/p&gt;

&lt;p&gt;But for Ubuntu users who want a portable operating system to keep handy, with the ability to save files, settings, and install tools without the complexity or hardcoded nature of a full installation, a persistent USB may be the ticket.&lt;/p&gt;

&lt;p&gt;You can download Rufus for Windows (32-bit and 64-bit) from the Rufus Github page.&lt;/p&gt;

</description>
      <category>rufus</category>
    </item>
    <item>
      <title>React Hooks</title>
      <dc:creator>PhantomThreads</dc:creator>
      <pubDate>Mon, 13 May 2024 01:36:26 +0000</pubDate>
      <link>https://dev.to/phantomthreads/react-hooks-gn4</link>
      <guid>https://dev.to/phantomthreads/react-hooks-gn4</guid>
      <description>&lt;p&gt;React provides many built-in hooks, such as useContext, useMemo, useRef, and useReducer, among others. These hooks allow developers to manage state, handle side effects, and improve performance in a more concise and efficient manner compared to traditional class components.&lt;/p&gt;

&lt;p&gt;The useContext hook, for example, enables components to access and consume values from React's Context API without the need for prop drilling. This simplifies the process of sharing data or functionality across the component tree.&lt;/p&gt;

&lt;p&gt;The useMemo hook is useful for memoizing expensive computations, ensuring that a function is only computed when its dependencies change. By caching the result of a computation, useMemo can optimize performance by preventing unnecessary re-renders.&lt;/p&gt;

&lt;p&gt;Refactoring class components to use hooks can result in cleaner, more readable code that is easier to maintain and test. Hooks encourage functional programming practices and make it simpler to reason about component behavior.&lt;/p&gt;

&lt;p&gt;Leveraging JavaScript hooks in React applications can lead to more efficient development workflows, improved code quality, and enhanced user experiences. By embracing the principles of functional programming and component-based architecture, developers can build robust, scalable applications that are easier to extend and maintain over time.&lt;/p&gt;

&lt;p&gt;JavaScript hooks have revolutionized the way developers work with React by providing a more intuitive and declarative approach to managing component logic and state. With hooks, developers can create more modular, reusable, and testable components, leading to a more efficient and enjoyable development experience.&lt;/p&gt;

&lt;p&gt;By embracing hooks, developers can take advantage of the full power of functional programming principles in their React applications, resulting in code that is easier to reason about and less error-prone. The flexibility and composability of hooks allow developers to build complex UIs with simple, composable units of logic.&lt;/p&gt;

&lt;p&gt;As the React ecosystem continues to evolve, hooks are becoming increasingly ubiquitous in modern React applications. By mastering the art of using hooks effectively, developers can unlock new levels of productivity and creativity in their front-end development work.&lt;/p&gt;

&lt;p&gt;Overall, the introduction of hooks in JavaScript has transformed the React landscape, empowering developers to build more robust and performant applications with greater ease and flexibility. With their ability to streamline component logic and state management, JavaScript hooks have become an essential tool for modern web development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Value of Frida Dynamic Instrumentation Toolkit to Cybersecurity</title>
      <dc:creator>PhantomThreads</dc:creator>
      <pubDate>Fri, 10 May 2024 00:45:38 +0000</pubDate>
      <link>https://dev.to/phantomthreads/value-of-frida-dynamic-instrumentation-to-cyber-community-3bka</link>
      <guid>https://dev.to/phantomthreads/value-of-frida-dynamic-instrumentation-to-cyber-community-3bka</guid>
      <description>&lt;p&gt;As the sophistication of cyber attacks continues to rise, organizations are increasingly turning to innovative solutions to bolster their cyber defenses. One such tool that has gained significant popularity in recent years is Frida, a dynamic instrumentation toolkit that empowers developers and security professionals to monitor and manipulate applications in real-time. By providing a powerful platform for runtime instrumentation, Frida offers unique capabilities that have proven instrumental in strengthening cybersecurity postures across a wide range of industries.&lt;/p&gt;

&lt;p&gt;At its core, Frida enables users to inject JavaScript, written by the user, into the memory space of running applications. This dynamic instrumentation allows security professionals to observe and modify the behavior of target applications on the fly, offering unparalleled visibility and control over their execution. By leveraging Frida's capabilities, security analysts can gain valuable insights into application behavior, identify potential vulnerabilities, and even patch security flaws in real-time.&lt;/p&gt;

&lt;p&gt;One of the key advantages of using Frida for cybersecurity purposes is its versatility and ease of use across different platforms and environments. Whether analyzing mobile applications on Android or iOS, reverse engineering desktop software on Windows or macOS, or dissecting web applications in a browser environment, Frida provides a consistent and powerful toolkit that adapts to diverse use cases. This flexibility makes Frida an invaluable asset for security researchers, penetration testers, and developers seeking to enhance the security of their applications.&lt;/p&gt;

&lt;p&gt;Moreover, Frida enables security professionals to conduct advanced security assessments and penetration testing activities with greater precision and efficiency. By attaching Frida to target processes and monitoring their runtime behavior, analysts can identify and exploit security vulnerabilities more effectively, helping organizations remediate threats before they can be exploited by malicious actors. Additionally, Frida's interactive interface and rich API empower users to create custom scripts and tools tailored to their specific security objectives, facilitating the automation of complex security tasks and accelerating the detection and mitigation of security risks.&lt;/p&gt;

&lt;p&gt;In conclusion, Frida represents a powerful and versatile tool for enhancing cybersecurity in an increasingly complex threat landscape. Its dynamic instrumentation capabilities, cross-platform support, and user-friendly interface make it an indispensable resource for security professionals looking to fortify their defenses and safeguard applications against evolving cyber threats. By leveraging Frida's real-time monitoring and manipulation capabilities, organizations can proactively identify vulnerabilities, remediate security flaws, and strengthen their overall security posture. As cybersecurity challenges continue to evolve, tools like Frida play a vital role in equipping defenders with the tools and insights needed to stay one step ahead of malicious actors.&lt;/p&gt;

&lt;p&gt;Documentation &lt;br&gt;
&lt;a href="https://frida.re/docs/home/"&gt;https://frida.re/docs/home/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install Frida&lt;br&gt;
&lt;a href="https://github.com/frida/frida"&gt;https://github.com/frida/frida&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;pip install frida-tools # CLI tools&lt;br&gt;
pip install frida       # Python bindings&lt;br&gt;
npm install frida       # Node.js bindings&lt;/p&gt;

</description>
      <category>frida</category>
      <category>security</category>
      <category>reversing</category>
    </item>
  </channel>
</rss>
