跳到正文
DEV Community· Ai2th·· 6 天前AI 評分45

cryptship Part 3:坦誠説明威脅模型,以加固措施提高攻擊成本

cryptship | Part 3 — An Honest Threat Model, and the Hardening That Raises the Cost

AI 導讀

cryptship 説明其威脅模型:磁碟上的映像是密文,但應用程式執行後,主機 root 仍可讀取容器記憶體中的明文。它透過交付編譯程式碼、加固執行環境及為每個授權加入浮水印提高攻擊成本,但不宣稱能阻止主機 root 讀取記憶體。v0.1.0 保證不能用 docker save 和 tar 讀取原始碼;線上 provider 可即時撤銷授權。

正文

Ai2th

Every "protect your code" product has to answer one question honestly: what about root? This part is cryptship's answer.


🧱 Where the line is

The image on disk is ciphertext. But once your app runs, its plaintext is in the container's memory, and root on the host can read that memory. No user-space trick changes that. Only two things truly do:

  1. a confidential-compute key provider (SEV-SNP or TDX with attestation), or
  2. keeping the crown-jewel logic server-side.

Everything else in cryptship raises the cost. We would rather say that plainly than sell you a lock that is not there.


🔧 Three ways cryptship raises the cost

1. Ship compiled code, not source

cryptship pack --transform-cmd "<your toolchain>" …

The transform runs over a copy of your app before it is encrypted. A memory dump then recovers compiled artifacts instead of readable source, which matters a lot when the attacker has AI tools that are good at reconstructing source. The repo includes a Python-bytecode recipe (scripts/compile-python.sh); swapping in Nuitka for native code is a one-line change. scripts/demo-compiled.sh shows the difference.

2. Harden the runtime

  • The loader marks itself non-dumpable.
  • Run the container non-root, with dropped capabilities, a read-only root filesystem, a tmpfs for the decrypted app, and the seccomp profile from deploy/.

That stops an attacker who is inside the container or not root. It does not stop root on the host.

3. Watermark every license

The loader writes .cryptship-manifest.json and exposes CRYPTSHIP_LICENSE_ID and CRYPTSHIP_CUSTOMER to your app. If an instance leaks, it traces back to its licensee. That is a deterrent, not a lock: a determined attacker can strip it.


✅ What it does guarantee

  • Nobody can read your source with docker save and tar.
  • A tampered or expired license cannot decrypt anything: validity is decryptability.
  • With the online provider, revocation is real and immediate.

🗺️ Roadmap

  • Real SEV-SNP / TDX attestation and a verifying key broker
  • Stronger machine binding: TPM sealing and cloud instance identity

If you work on confidential computing and want to help, we would love to hear from you.

🔗 cryptship

來源:DEV Community · dev.to