错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

ShellMamba: Anomaly Detection of Shell Command Sequences

  • Qiwei Zong,
  • Yongqiang Dong,
  • ShiShun Zhu,
  • Xingshen Wei

摘要

Shell command anomaly detection plays a vital role in securing large-scale information systems, where malicious or erroneous commands may introduce significant operational risks. However, existing methods often fail to jointly model fine-grained command semantics and long-range contextual dependencies, limiting their ability to detect subtle anomalies. To address this issue, we propose ShellMamba, a unified framework for representation learning and anomaly detection over shell command sequences. ShellMamba employs a multi-granularity learning strategy that captures both semantic structures and temporal dependencies through masked sequence modeling and contextual prediction. Furthermore, we design a two-stage detection mechanism that combines session-level reconstruction with command-level predictive modeling. This design enables the identification of both global behavioral deviations and fine-grained anomalous commands. Experimental results on real-world enterprise datasets show that ShellMamba consistently outperforms existing methods, achieving average improvements of 6.5% in precision, 10.5% in recall, and 8.7% in F1-score. Notably, the proposed self-supervised framework eliminates the need for labeled anomalies while maintaining effective optimization via multi-scale consistency learning.