← Lab /Security & privacy

AST-fine-tuned CodeBERT detects PowerShell fileless cryptojacking with high recall

AST-based fine-tuned CodeBERT achieves high recall for detecting PowerShell-based fileless cryptojacking scripts

Security & privacy arXiv 20 Feb 2026 Method Prototype evidence

Published as “Detecting PowerShell-based Fileless Cryptojacking Attacks Using Machine Learning”

Why it matters

A high-recall, low-overhead model could be integrated into endpoint detection tools to spot fileless cryptojacking scripts that evade traditional file-based scanners.

Summary

The paper reports that an AST-based fine-tuned CodeBERT model detects PowerShell-based fileless cryptojacking scripts with a recall of 96.6%, outperforming non-AST baselines. They built a unique dataset of malicious PowerShell scripts and evaluated several LSTM-type models and CodeBERT variants. Evidence comes from a single experimental study on this private dataset; no external benchmarks or large-scale deployment are presented.

What they found 2

  1. AST-based fine-tuned CodeBERT achieved a recall of 96.6% on the dataset.

    “AST-based fine-tuned CodeBERT achieved a high recall rate of 96.6% proving the usage of AST can improve the recall score of CodeBERT model.”

  2. AST-based CodeBERT matches the accuracy of non-AST CodeBERT while improving recall.

    “The results showed that Abstract Syntax Tree (AST)-based fine-tuned CodeBERT achieved a high recall rate, proving the importance of the use of AST integration and fine-tuned pre-trained models for programming language.”

Caveats 4

  • Although some other models in the literature provided higher recall rates, our approach brought a more efficient solution.
  • Although our model does not achieve top results compared to other models, it improves performance in terms of efficiency.
  • As a limitation of this study, dataset creation is extremely challenging due to the difficulty of accessing malicious scripts.
  • Our approach does not include obfuscation and de-obfuscation processes, which may affect performance on heavily obfuscated payloads.

What’s new here 4

  • First work to target PowerShell-based fileless cryptojacking specifically with machine learning.
  • Applies AST-based tokenization to CodeBERT for code-level analysis of malicious scripts.
  • Achieves high recall without any handcrafted feature extraction, reducing computational overhead.
  • Compares AST-enabled models against non-AST counterparts on the same dataset.