open-obfuscator / o-mvll

:electron: O-MVLL is a LLVM-based obfuscator for native code (Android & iOS)
https://obfuscator.re/omvll
Apache License 2.0
574 stars 62 forks source link

iOS string encoding produces plain-text duplicate #20

Closed weliveindetail closed 2 months ago

weliveindetail commented 12 months ago

Description

The string-encoding pass removes or encodes strings in a binary. We have it working on x86 Linux and arm64 macOS. When we run it with triple arm64-apple-ios, however, it appears to produce a wrapped version of the encoded string by accident.

How to reproduce the issue

  1. Check out main, configure a build and run ninja check
  2. It will report passes/strings-encoding/basic-aarch64.cpp as "Expectedly Failed"
  3. Run the test in isolation: bin/llvm-lit -a --filter=basic-aarch64 test. The output will be something like this:
    o-mvll/src/test/passes/strings-encoding/basic-aarch64.cpp:29:24: error: CHECK-REPLACED-NOT: excluded string found in input
    // CHECK-REPLACED-NOT: [[FILE_NAME]]
                       ^
    <stdin>:33:3: note: found here
    l_o-mvll/src/test/passes/strings-encoding/basic-aarch64.cpp:.str.2
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <stdin>:33:3: note: with "FILE_NAME" equal to "o-mvll/src/test/passes/strings-encoding/basic-aarch64\\.cpp"
    l_o-mvll/src/test/passes/strings-encoding/basic-aarch64.cpp:.str.2
    ^

O-MVLL Python Configuration

https://github.com/open-obfuscator/o-mvll/blob/9ce24ea838970558fbff1549e5a3fe1a1299866d/src/test/passes/strings-encoding/config_replace.py

Environment

Additional context

It cannot be reproduce on x86 macOS right now, because clang crashes for a different reason before.

weliveindetail commented 12 months ago

Thanks to @antoniofrighetto for fixing the target triples in the iOS tests https://github.com/open-obfuscator/o-mvll/pull/19, which revealed this issue!