LogoLogo
  • Welcome to Cyphor
  • .NET Code Obfuscation
    • Getting Started
    • How to Obfuscate
    • Basic Code Obfuscation
      • Symbol Renaming
      • Body Mutation
      • Control Flow
      • Constant Encryption
      • Call Hiding
      • Debug Protection
      • Integrity Checks
      • Self Healing
    • Advanced Obfuscation
      • Attribute-Based Obfuscation
      • Guide to obfuscation
      • Code Inlining
      • What is RASP?
      • Protections that protect each other
      • Program not working after obfuscation
      • Keeping performance with obfuscation
      • Virtualization
  • Dashboard
    • Files
    • Billing
      • Pay as you go
      • Examples
    • Projects
      • Code Guard Tasks
      • Permissions
        • Roles
      • Files
      • SAML and SSO
  • Code Guard
    • Introduction
    • Implement with your licensing system
      • Setting up a gateway
      • Setting up the SDK
    • Secured values
      • Dynamic values
      • Code Encryption
        • Page 1
    • Preventing analysis
    • Enhanced visibility
      • Disabling tracing on production
      • Logging external methods
      • Optimizing Memory Usage
    • Edge connectivity
    • Preventing modifications
      • Preventing assembly load
      • Allowing partial tampering
      • Enterprise EDRs and XDRs
      • Dynamic Hook protection
      • Thread hijacking
      • Guard Checksums
      • DLL Injection
      • Handling complex RE attacks
        • Custom payload detection
    • Granular Integrity Checks
    • Virtualized Environments
    • Troubleshooting
    • Threat database
    • Real time alerts
      • Alert Insights
  • CLI Tool
    • Introduction
    • Global options
    • Profiles
    • Projects
    • Obfuscator
      • Obfuscation Schemes
      • Task templates
      • Protecting files
        • Global obfuscation flags
        • Using templates to obfuscate files
        • Quick obfuscation
      • Monitoring obfuscation jobs
    • Securing local storage
Powered by GitBook
On this page
  • Motivation
  • Obfuscation SDK
  • Enabling a Protection using the SDK
  • Methods
  • Types

Was this helpful?

  1. .NET Code Obfuscation
  2. Advanced Obfuscation

Attribute-Based Obfuscation

PreviousAdvanced ObfuscationNextGuide to obfuscation

Last updated 3 years ago

Was this helpful?

Motivation

Sometimes you might feel the urge to apply specific protections to special parts of your code, attribute based obfuscation (also known as declarative obfuscation) allows you to choose which features to apply on a given type or method.

For example, your application might be formed by two main components, one linked with the authentication and copy protection of your software, and another one which is the core of your application itself. In those scenarios, it makes perfect sense to use a lightweight obfuscation in the whole assembly and more aggressive protection on the anti-piracy part.

Simultaneously, you might find yourself looking to add exceptions or special rules to certain methods or types, all that and more is possible with our SDK.

Obfuscation SDK

Legacy tools tended to rely on the shipped within .NET itself. This attribute works well until more complex scenarios and sub-settings of obfuscation technologies appear. For this reason, ever since our first public release, we recommend using our SDK instead of the classical Obfuscation Attribute.

Our SDK allows you to place rules in the most human-friendly manner, we achieve this by making a separated attribute for each one of our protections.

Enabling a Protection using the SDK

Methods

Suppose that there is a method that you want to protect more than others. You can achieve this by using the proper protection attributes.

[Virtualization()]
public static void MyImportantMethod()
{
// Your code goes in here
}
<Virtualization()>
Public Shared Sub MyImportantMethod()
// Your code goes in here
End Sub

Simultaneously, you can stack multiple protections on the same method.

[ControlFlow()]
[Virtualization()]
public static void MyImportantMethod()
{
// Your code goes in here
}
<ControlFlow()>
<Virtualization()>
Public Shared Sub MyImportantMethod()
// Your code goes in here
End Sub

Suppose there is a class that you want to protect more than others. You can do this by using the proper protection attributes.

[Virtualization()]
public class MyClass {
// Class code
}
<Virtualization()>
Public Shared Sub MyImportantMethod()
// Your code goes in here
End Sub

Simultaneously, you can stack multiple protections on the class.

[ControlFlow()]
[Virtualization()]
public class MyClass {
// Class code
}

The order in which you place the attributes does not affect the obfuscation result.

Types

❗
📤
☕
⚒️
🧠
📥
Obfuscation Attribute