A cross language scalable & extendable
code & db obfuscator based on patterns
 
Abstract

Abstract

Rx is a cross language obfuscator, helps to obfuscating the code with communication continuity.

A new challenge came to us, that we have to obfuscate a web application had a development of more than two years implemented in Perl.PHP,JS,HTML,CSS ,PostgreSQL.

For an example, a HTML element in form input id=”first_name”, validated in JavaScript document.getElementById(‘first_name’), formatted by element id method in CSS #first_name{..}, communicated to PHP/Perl $_POST[‘first_name’]/$CGI->param(‘first_name’) inserted in DB as INSERT INTO table_name(first_name).. and finally send back to HTML by Template Variables TMPL_VAR FIRST_NAME from PHP/Perl. It’s a straight communication, but the real time usage has variance in different attitudes in implementation subject to the language methods. Now all the “first name” should be replaced by ‘*****’

A challenge and opportunity came together. Initial attempts were taken by commercial tools and c in Linux environment. But the cross language usage variances become a challenge. We unable to treat different things as different things, we have to find different usages of single communication and treat them similar way to maintain the communication between languages.

Instead of find and replace, we followed to capture the keys (first_name) in various possible contexts, then index it (1=>first_name) and finally obfuscate it (1=>’zxcde’). It‘s worked better than straight (A=>B) replacements.

In this talk, we will share the journey of Rx tool evaluation and how the Perl’s Regular Expression and natural expressiveness saved the day. I will hint on basic usage, internal structure, scalability & extendibility

Scalable

Extendable

 

Talk

x ways to replacement

  • Challenge

    Classify the coding way:

    • Language specific general methods
    • Language specific custom methods
    • Coding style & uniformity
    • Code neutralize

  • MAP

    Built patterns to capture

    • Case files with code usage
    • Building Pattern to capture custom & generic usuages
  • Capture Keys

    Action keys to process

    A key generation process will capture all the keys to be replaced in each action (Perl/PHP/HTML..) and create a key/replacement dictionary.

  • Pre-Replacement

    Preview the key actions

    A preview run will show the replacements for each file, each line with possible replacements. It will help to evaluate patterns.

  • Replacement

    Start Action

    It will replace all the actions in a cloned copy. A watch mode will inform the status by each file and action.

  • Post Replacement

    Action Replay

    A run log will be created on each replacement on each file by every line. It will help us to evaluate the replacements.

  • Rx

    A Perl Journey