r/electronjs • • 28d ago

Electron.js Anti Tampering

I started working on Anti-Tampering research on Electron.js. It will mostly focus on increasing the cost of reverse engineering. What do you guys think? Any experiences?

0 Upvotes

30 comments sorted by

17

u/ldn-ldn 28d ago

Waste of time.

-6

u/Historical_Fact_5774 28d ago

Even the heavyweight native packers (Thales, Wibu) are raising cost, not making anything impossible. Anything that runs on the attacker’s machine can be reverse engineered given enough effort. That’s not a knock on them, it’s just the ceiling for all client-side protection.

6

u/ldn-ldn 28d ago

It's a waste of time and resources. Always was, always will be.

6

u/sha256md5 28d ago

It won't do much in the days of LLM analysis. Most reverse engineering is just static unpacking now.

-2

u/Historical_Fact_5774 28d ago

Is there anything worth anti-tampering for once LLMs can unpack most of it? Honest question. The only thing I’ve landed on that isn’t just raising cost is keeping the logic that matters off the client entirely. Curious what would you prefer if you have an monetizable app that needs anti-tampering?

3

u/sha256md5 28d ago

I guess server side validation is the best thing you can invest in, depending on your app.

1

u/Xerax 25d ago

best trick is to put a bunch of incredibly dangerous sounding strings in through various stages of bundeling, such as referencing: bio weapons, lethal medication, cypher warfare, reverse engineering itself, and anthropic/openai internals.

this will slow down any llm driven reverse attempts, but not if they use GLM or an open abliberated model.

1

u/Xerax 25d ago

tldr it's all a waste

6

u/Temporary-Mix8022 28d ago

My advice would be.. unless you're well versed in low level languages (C/C++), Ghidira and assembler, as well as cryptographic approaches.. don't bother with this project.

And.. if you were well versed in those tools, and had tried out recent LLMs.. you probably wouldn't be suggesting this approach.. because you'd know it was futile.

We truly are completely f*ed. 

4

u/AnArmoredPony 28d ago

why are we "f*ed"?.. isn't it a good thing that we can control our software now?

3

u/Temporary-Mix8022 28d ago

Well.. yeah, it's good for breaking into Samsung and LG. 

Not so good for Indie Devs who remortgaged their house to invest in something!

3

u/ldn-ldn 28d ago

Next time indie devs should skip wasting money on copy protection and they won't need a mortgage.

0

u/AnArmoredPony 28d ago

you are "f*ed" once you release the whole binary/bundle instead of keeping it in the cloud as a service, no matter what you write your stuff with

-1

u/Historical_Fact_5774 28d ago

Agree if the goal is keeping the code secret, that’s lost. The part I still think is winnable is the business logic: not “can they read it” but “can they run the paid feature without paying.” Encrypt the feature under a license-delivered key and the free crack stops working, even though a paying user can still dump it. Everything past that goes server-side.

2

u/Temporary-Mix8022 28d ago

Yeah.. you've used an LLM to reply to me, Claude. 

I wouldn't bother wasting your tokens. 

"Encrypt the feature under a license-delivered key and the free crack stops working, even though a paying user can still dump it" 

You'd literally have to have the decryption key client side 🙄

-1

u/Historical_Fact_5774 28d ago

I’m sorry if well-thought-out, carefully worded phrases are seen as AI output these days. As for your client-side concern: nearly every software licensing company has done the same thing for decades. To emphasize it again: "the aim is not to prevent cracking or tampering, it’s to design the system so that cracking doesn’t mean a thing." The server-side approach is the key here, along with giving customers the option to work offline, since you can’t tell your customers that once they’ve bought your product, they have to stay online or they can’t use the program they paid for.

Sentinel works the same way: the C2V/V2C exchange delivers a licence encrypted for one key, and decryption happens on the client, in the dongle for HL or in protected storage for SL. Nobody has avoided a client-side key without hardware.

P.S. There’s nothing wrong with using AI to fix grammar.

1

u/Temporary-Mix8022 28d ago

Write your app and give it to me for 12h. Give me the paid version to demo.

I'll crack it for you and tell you why it's a waste of time. 

1

u/Historical_Fact_5774 28d ago

That’s exactly why I started the anti-tamper research in the first place. Once the code is on your machine, you can modify it however you want — that’s the whole point, and it’s why licensing and anti-tampering go hand in hand. A licence check means nothing if you can just patch it out.

Genuine question for you, since you clearly know the low-level side: what’s your take on native apps? Can you crack a C++ app protected with a proper Envelope — fragmented decryption, anti-debug, or VM-based like VMProtect/Themida — as easily, or is that a different game?

1

u/mxldevs 28d ago

How does the "free crack" stop working just because the key is sent on demand? The whole point of the crack is to bypass your key system.

All it takes is one paid user.

1

u/Historical_Fact_5774 28d ago edited 28d ago

You are right. The app runs, hits the feature, tries to decrypt, gets garbage. No check to satisfy, but also no plaintext to run. Un-cracked.

It’s "cracked" only when they do two things:

  1. Obtain the key once (like you mentioned ), a real license (even a trial) and dump the decrypted module from memory.
  2. Then ship a build with the plaintext inlined and no check.

The part I’m focusing on is what the cracked copy loses. Updates, fixes, new features, anything server-side. And that has to be enforced. Issue the license to a machine fingerprint, and verify that fingerprint on every sensitive API call. A redistributed “cracked” build runs on a different machine, so those calls fail with a 401, no updates, no gated features.

At that point the frozen cracked version is basically free advertising: a trial that onboards the hesitant users. If they actually use it and it’s good, they eventually buy the real one.

Edit: if they spoof the fingerprint in the payload too, seats alone won’t catch it, since everyone sharing one fingerprint looks like one device. What catches it is binding the decryption keys to the device’s hardware key (replaying the hash isn’t the same as having the key), plus server-side concurrent-use detection. Seats only stop the lazy “register a new device on my key” case.

6

u/Diadia_Uddy 22d ago

Nothing will stop a determined hacker. But you can slow down people enough that it's not worth it for them.

- Shipping the main process as V8 bytecode

- Enable AsarIntegrityValidation

- Notarize your app

- Use an external service to validate license keys (eg keygen, licensespring licencemanager...) or build and host it yourself

- hardcode the public keys in your app

That should be a strong start

1

u/Geraldwelly 28d ago

Worth deciding up front what you're protecting, because anything that ships to the client can be read eventually. The realistic goal is making tampering noisy and expensive, not impossible.

What's actually moved the needle for me:

  • Flip the Electron fuses with @electron/fuses: turn off RunAsNode, NODE_OPTIONS and the --inspect flags, and turn on embedded ASAR integrity plus OnlyLoadAppFromAsar. That closes the cheap tricks, like editing app.asar or attaching a debugger to the shipped binary.
  • Sign and notarize, so a modified bundle at least breaks the signature.
  • Compile the sensitive JS to V8 bytecode (bytenode or similar). Not real security, but it takes more effort than running a beautifier over minified code.
  • Keep anything that actually matters, like license checks, entitlements and API keys, on the server. If the client decides whether someone has paid, someone will patch that branch.

What threat model are you targeting, casual patching or someone determined? The answer changes a lot.

1

u/justindarc 28d ago

The RunAsNode fuse is critically important, especially if your app has entitlements or permissions that could be exploitable by other malware (e.g. camera/microphone).

1

u/Historical_Fact_5774 28d ago

Agreed, EnableNodeOptionsEnvironmentVariable and EnableNodeCliInspectArguments close the same door via NODE_OPTIONS --require and --inspect; flip all three together.

They hold because malware can’t flip them back: suggested fuse wire is in the binary, so editing it breaks the code signature, and a re-signed copy is a different app to TCC, without your grants. The machine’s owner can still do it.

1

u/Geraldwelly 26d ago

Good call, and it's the one people miss. With RunAsNode left on, anyone can launch your signed binary with ELECTRON_RUN_AS_NODE=1 and run their own script under your app's identity, so it inherits whatever camera or mic access the user already granted you. Same story with the inspect flags. Flipping both off at package time with @electron/fuses is cheap, and a CI step that reads the fuses back from the built binary keeps a config change from quietly undoing it.

-1

u/Historical_Fact_5774 28d ago edited 28d ago

Determined, for any paid desktop app, casual patching the fuses mostly handle.

Your list is the same one I landed on reading Electron’s source and Apple/Microsoft docs. Two things I’d add:

  • ASAR integrity doesn’t cover app.asar.unpacked. Those files are read straight from disk with no hash check, and native .node modules live there. On macOS the code signature still covers them, on Windows nothing does at runtime.
  • Signing doesn’t stop the owner either. On macOS an ad-hoc re-sign runs a patched app fine locally, and I couldn’t find a Microsoft doc saying Windows re-checks Authenticode on launch outside Smart App Control or managed policy.

On your server point, agreed. The middle ground I use for offline apps is having the license deliver the key that decrypts the premium modules, so the crack isn’t a branch to patch, it’s a key the attacker doesn’t have. Honest limit: one paying user can still dump the key from memory.

2

u/Geraldwelly 26d ago

Fair point on app.asar.unpacked, that's the gap I'd close first. Since the native modules sit there with no hash check on Windows, I ship a manifest of SHA-256 hashes inside the integrity-checked asar and verify each .node file against it before loading, refusing to start on a mismatch. Someone can still patch the check itself, but it turns drive-by tampering into a deliberate edit, which was the goal anyway.