Skip to content

String obfuscation doesn't works with rust #28

@dzamlo

Description

@dzamlo

String obfuscation doesn't work with rust at the moment.

For simple string, the issue is that they don't end with a \0 byte and thus are filtered by the changes introduced in commit ddc0fec.

Strings used in format strings are encoded in a rust specific way, and they sometimes contains \0 and are thus filtered by the check at the start of encodeStringDataArray.

For examples, the following rust code:

use std::env::args;

fn main() {
    print!("Hello, world1!");
    print!("Hello, world2! {}", args().len());
    print!("Hello, world3! {} abc", args().len());
    print!("Hello, world4! {:?} def", args().len());
    print!("Hello, world5! {:#?} ghi", args().len());
}

Gives the following constants:

@alloc_061c499ced2e2808a8ca796c5b4da0a8 = private unnamed_addr constant [14 x i8] c"Hello, world1!", align 1
@alloc_2f3fcc85df179a05e7e9fbeacb04fa5a = private unnamed_addr constant [23 x i8] c"\0FHello, world2! \C0\04 abc\00", align 1
@alloc_aefc1c9b066e4226d1d0c77fd47abd63 = private unnamed_addr constant [23 x i8] c"\0FHello, world3! \C0\04 def\00", align 1
@alloc_860c3ba3831d241cd330fc03ee6a86ec = private unnamed_addr constant [27 x i8] c"\0FHello, world4! \C1 \00\80`\04 ghi\00", align 1

In this case both the first and last strings are not obfuscated.

I don't know if there is simple solution, but if there isn't, this should likely be documented in the README.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions