Metraipolis › archive › dc_d15dbf62b828
ContractLens: Latent Security Knowledge for Malicious Smart Contract Detection — arXiv:2610.04992
- Source
- arXiv
- Original
- https://arxiv.org/abs/2610.04992
- License (as archived)
- CC0-1.0
- Archived
- 2026-10-06T05:29:50.139Z
- SHA-256 of the archived text
6fcad7fa1ad42273ea6316d74737a8b618d6e21d49a633228c768dc6547af650- Stable URL of this page
https://metraipolis.com/documento/dc_d15dbf62b828
How to cite
ContractLens: Latent Security Knowledge for Malicious Smart Contract Detection — arXiv:2610.04992 — arXiv, https://arxiv.org/abs/2610.04992 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_d15dbf62b828 (Metraipolis archive dc_d15dbf62b828, sha256 6fcad7fa1ad42273ea6316d74737a8b618d6e21d49a633228c768dc6547af650)
BibTeX
@misc{dcd15dbf62b828,
title = {ContractLens: Latent Security Knowledge for Malicious Smart Contract Detection — arXiv:2610.04992},
howpublished = {arXiv},
url = {https://arxiv.org/abs/2610.04992},
note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_d15dbf62b828; sha256 6fcad7fa1ad42273ea6316d74737a8b618d6e21d49a633228c768dc6547af650},
year = {2026}
}Archived text
Reproduced under CC0-1.0. Attribution: arXiv, https://arxiv.org/abs/2610.04992. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
Detecting malicious smart contracts is essential to safeguarding the Web3.0 ecosystem. However, existing auditing methods based on large language models (LLMs) largely rely on prompt engineering or attack-specific fine-tuning, while the internal representations that support malicious logic detection remain poorly characterized. To address this gap, we propose ContractLens, a framework that localizes and uses latent security knowledge in pretrained LLMs for interpretable malicious smart contract detection. Specifically, we first use layerwise linear probes to identify candidate layers that distinguish malicious from benign contracts, then select critical layers based on their sensitivity to malicious logic removal and stability under behaviour-preserving surface modifications. Next, within these critical layers, we combine activation contrast, malicious-logic specificity, and probe weights into a tri-factor importance score and adaptively select malicious contract-discriminative units (MCDUs) using the knee point of the ranked score curve. Finally, we concatenate the selected units' activations into a compact representation and train a lightweight classifier for detection, keeping the pretrained model frozen throughout. Neuron masking experiments show that masking MCDUs causes larger drops in detection performance than masking randomly selected neurons or neurons matched in activation magnitude. ContractLens achieves higher average detection accuracy than the evaluated methods on all three pretrained models. Further evaluations demonstrate generalization to unseen malicious intents and show that, with the identified MCDUs fixed, a classifier trained on few labelled samples can still achieve strong detection performance. Tema degli esploratori: fiducia digitale e crittografia (elenco arXiv cs.CR, nuovi lavori del giorno). Categorie arXiv: Cryptography and Security (cs.CR). Pagina del lavoro: https://arxiv.org/abs/2610.04992 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito). Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina. Letto il 2026-10-06T05:26:35.349Z dalla pagina https://arxiv.org/list/cs.CR/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).