Towards Secure Logging: Characterizing and Benchmarking Logging Code Security Issues with LLMs
He Yang Yuan, Xin Wang, Kundi Yao, An Ran Chen, Zishuo Ding, Zhenhao Li
Abstract
Logging code plays an important role in software systems by recording key events and behaviors, which are essential for debugging and monitoring. However, insecure logging practices can inadvertently expose sensitive information or enable attacks such as log injection, posing serious threats to system security and privacy. Prior research has examined general defects in logging code, but systematic analysis of logging code security issues remains limited, particularly in leveraging LLMs for detection and repair. In this paper, we derive a comprehensive taxonomy of logging code security issues, encompassing four common issue categories and 10 corresponding patterns. We further construct a benchmark dataset with 101 real-world logging security issue reports that have been manually reviewed and annotated. We then propose an automated framework that incorporates various contextual knowledge to evaluate LLMs' capabilities in detecting and repairing logging security issues. Our experimental results reveal a notable disparity in performance: while LLMs are moderately effective at detecting security issues (e.g., the accuracy ranges from 12.9% to 52.5% on average), they face noticeable challenges in reliably generating correct code repairs. We also find that the issue description alone improves the LLMs' detection accuracy more than the security pattern explanation or a combination of both. Overall, our findings provide actionable insights for practitioners and highlight the potential and limitations of current LLMs for secure logging.
CCS Concepts: • Software and its engineering → Software creation and management.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 41dfb07a-a360-4d3d-90ea-26e5bf1c15c6Builds on26
- CodeT5+: Open Code Large Language Models for Code Understanding and GenerationYue Wang, Hung Le, Akhilesh Gotmare, Nghi D. Q. Bui et al.EMNLP 2023 · 339 citations
- Vulnerability detection with fine-grained interpretationsYi Li, Shaohua Wang, Tien N. NguyenFSE 2021 · 283 citations
- What Makes a Good Commit Message?Yingchen Tian, Yuxia Zhang, Klaas-Jan Stol, Lin Jiang et al.ICSE 2022 · 90 citations
- LILAC: Log Parsing using LLMs with Adaptive Parsing CacheZhihan Jiang, Jinyang Liu, Zhuangbin Chen, Yichen Li et al.FSE 2024 · 85 citations
- Using Deep Learning to Generate Complete Log StatementsAntonio Mastropaolo, Luca Pascarella, Gabriele BavotaICSE 2022 · 60 citations
Related papers
- Defects4Log: Benchmarking LLMs for Logging Code Defect Detection and ReasoningXin Wang, Zhenhao Li, Zishuo DingASE 2025 · 1 citation
- LogicEval: A Systematic Framework for Evaluating Automated Repair Techniques for Logical Vulnerabilities in Real-World SoftwareSyed Md. Mukit Rashid, Abdullah Al Ishtiaq, Kai Tu, Yilu Dong et al.ACL 2026
- SEC-bench: Automated Benchmarking of LLM Agents on Real-World Software Security TasksHwiwon Lee, Ziqi Zhang, Hanxiao Lu, Lingming ZhangNeurIPS 2025 · 86 citations
- Can You Really Trust Code Copilot? Evaluating Large Language Models from a Code Security PerspectiveYutao Mou, Xiao Deng, Yuxiao Luo, Shikun Zhang et al.ACL 2025 · 4 citations
- UniLog: Automatic Logging via LLM and In-Context LearningJunjielong Xu, Ziang Cui, Yuan Zhao, Xu Zhang et al.ICSE 2024 · 56 citations
