Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structural matching for static scanning #4

Open
20 tasks
Col-E opened this issue Jul 10, 2023 · 1 comment
Open
20 tasks

Structural matching for static scanning #4

Col-E opened this issue Jul 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Col-E
Copy link
Collaborator

Col-E commented Jul 10, 2023

Comment in code: StandardScan.java#L46

Capabilities to address:

  • Common properties (classes, fields, methods)
    • Modifiers of the common element
    • Names of the common element with TextMatchMode support.
      • Should be offered, but ideally not used often due to obfuscation randomizing names.
    • Names of, or inclusion of, unknown attributes (Non-standard attributes defined by JVMS spec)
    • Annotations
      • Check for duplicates (Not allowed by javac)
      • Name matching
      • Number of annotations
  • Class properties
    • Inner classes
      • Names
      • Number of items
      • Duplicate check
  • Field properties
    • Values of fields.
  • Method properties
    • Check if local variable slot 0 in virtual methods is not named this. javac emits this by default, always. Different values imply obfuscation.

Now, for detecting obfuscation some ideas:

  • Add some kind of entropy checking option to TextMatchMode to facilitate name obf detection
    • Currently all options define BiPredicate<String, String> so how will we pass an entropy cut off value? Do we just provide different entropy cutoff points as enum entries? Would be the most simple way to go, but hinders customization.
    • Alternatively, we don't add this feature to TextMatchMode and go about it in a different way with its own unique matcher
  • Method control flow cyclomatic complexity detection
  • Reference obfuscation detection (per method/class/input?)
    • Very low counts of direct field/method references, instead using invokedynamic indirection

Feel free to discuss additional ideas.

@Col-E Col-E added the enhancement New feature or request label Jul 10, 2023
@Col-E
Copy link
Collaborator Author

Col-E commented Jul 10, 2023

For obfuscation we have some reference samples to look at: https://github.com/GenericException/SkidSuite/tree/master/obf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant