惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Full Disclosure
Recorded Future
Recorded Future
T
Tenable Blog
S
Securelist
C
CERT Recently Published Vulnerability Notes
T
Threatpost
S
Schneier on Security
A
Arctic Wolf
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Register - Security
The Register - Security
Cisco Talos Blog
Cisco Talos Blog
AWS News Blog
AWS News Blog
K
Kaspersky official blog
T
True Tiger Recordings
T
Threat Research - Cisco Blogs
V
Vulnerabilities – Threatpost
P
Palo Alto Networks Blog
T
The Exploit Database - CXSecurity.com
小众软件
小众软件
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
Cyberwarzone
Cyberwarzone
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tor Project blog
Spread Privacy
Spread Privacy
Malwarebytes
Malwarebytes
P
Proofpoint News Feed
F
Fox-IT International blog
F
Fortinet All Blogs
P
Privacy & Cybersecurity Law Blog
G
GRAHAM CLULEY
量子位
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
Project Zero
Project Zero
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
I
Intezer
博客园_首页
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Darknet – Hacking Tools, Hacker News & Cyber Security

Black Hills Information Security, Inc.

Same Problem, Different Angles: When Red Team and Blue Team Actually Talk to Each Other How to Identify and Exploit New Vulnerabilities Swapper – A Pure Regex Match/Replace Burp Extension A Practical Guide to BloodHound Data Collection Network Engineering Basics Signed, Trusted, and Abused: Proxy Execution via WebView2 Getting Started In Pentesting – Advice From The BHIS Pentest Lead Cloud Security: Tips and Resources for Securing the Cloud Lessons From A Chatbot Incident How to Lead Effective Tabletops Understanding GRC: How to Navigate Risks and Compliance Standards The “P” in PAM is for Persistence: Linux Persistence Technique Malware Analysis: How to Analyze and Understand Malware OSINT: How to Find, Use, and Control Open-Source Intelligence What to Do with Your First Home Lab When the SOC Goes to Deadwood: A Night to Remember Social Engineering and Microsoft SSPR: The Road to Pwnage is Paved with Good Intentions Common Cyber Threats Finding the Right Penetration Testing Company Deceptive-Auditing: An Active Directory Honeypots Tool The Curious Case of the Comburglar How to Set Smart Goals (That Actually Work For You) Inside the BHIS SOC: A Conversation with Hayden Covington Abusing Delegation with Impacket (Part 3): Resource-Based Constrained Delegation Why You Got Hacked – 2025 Super Edition Abusing Delegation with Impacket (Part 2): Constrained Delegation Abusing Delegation with Impacket (Part 1): Unconstrained Delegation GoSpoof – Turning Attacks into Intel Model Context Protocol (MCP) Bypassing WAFs Using Oversized Requests Getting Started with AI Hacking Part 2: Prompt Injection Wrangling Windows Event Logs with Hayabusa & SOF-ELK (Part 2) DomCat: A Domain Categorization Tool Wrangling Windows Event Logs with Hayabusa & SOF-ELK (Part 1) Microsoft Store and WinGet: Security Risks for Corporate Environments Default Web Content MailFail Commonly Abused Administrative Utilities: A Hidden Risk to Enterprise Security Stop Spoofing Yourself! Disabling M365 Direct Send Bypassing CSP with JSONP: Introducing JSONPeek and CSP B Gone Offensive Tooling Cheatsheets: An Infosec Survival Guide Resource DNS Triage Cheatsheet GraphRunner Cheatsheet Burp Suite Cheatsheet Impacket Cheatsheet Wireshark Cheatsheet Hashcat Cheatsheet EyeWitness Cheatsheet Nmap Cheatsheet Netcat (nc) Cheatsheet Hunt for Weak Spots in Your Wireless Network with Airodump-ng from the Aircrack-ng Suite Detecting ADCS Privilege Escalation Vulnerability Scanning with Nmap Getting Started with NetExec: Streamlining Network Discovery and Access How to Use Dirsearch Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 3: Arcanum Cyber Security Bot How to Design and Execute Effective Social Engineering Attacks by Phone Abusing S4U2Self for Active Directory Pivoting Why Use a Macro Pad? Espanso: Text Replacement, the Easy Way Caging Copilot: Lessons Learned in LLM Security Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 2: Copilot Augmenting Penetration Testing Methodology with Artificial Intelligence – Part 1: Burpference Intercepting Traffic for Mobile Applications that Bypass the System Proxy How to Root Android Phones Communicating Security to the C-Suite: A Strategic Approach Offline Memory Forensics With Volatility Getting Started with AI Hacking: Part 1 Go-Spoof: A Tool for Cyber Deception How to Test Adversary-in-the-Middle Without Hacking Tools Canary in the Code: Alert()-ing on XSS Exploits How to Hack Wi-Fi with No Wi-Fi Why Your Org Needs a Penetration Test Program Burp Suite Extension: Copy For Light at the End of the Dark Web Wi-Fi Forge: Practice Wi-Fi Security Without Hardware Avoiding Dirty RAGs: Retrieval-Augmented Generation with Ollama and LangChain Gone Phishing: Installing GoPhish and Creating a Campaign 5 Things We Are Going to Continue to Ignore in 2025 John Strand’s 5 Phase Plan For Starting in Computer Security Questions From a Beginner Threat Hunter GRC for Security Managers: From Checklists to Influence AI Large Language Models and Supervised Fine Tuning Attack Tactics 9: Shadow Creds for PrivEsc w/ Kent & Jordan One Active Directory Account Can Be Your Best Early Warning Introduction to Zeek Log Analysis Indecent Exposure: Your Secrets are Showing Creating Burp Extensions: A Beginner’s Guide Pitting AI Against AI: Using PyRIT to Assess Large Language Models (LLMs) The Top Ten List of Why You Got Hacked This Year (2023/2024) ICS Hard Knocks: Mitigations to Scenarios Found in ICS/OT Backdoors & Breaches Intro to Data Analytics Using SQL Finding Access Control Vulnerabilities with Autorize The Detection Engineering Process Cyber Risk Lessons We Can Learn From Hurricane Preparedness Intro to Desktop Application Testing Methodology What Is Penetration Testing? Adversary in the Middle (AitM): Post-Exploitation Pentesting, Threat Hunting, and SOC: An Overview QEMU, MSYS2, and Emacs: Open-Source Solutions to Run Virtual Machines on Windows
Backdoors & Breaches: Logon Scripts
2020-04-06 · via Black Hills Information Security, Inc.

David Fletcher //


This blog post discusses the relevance and techniques involved in logon script abuse. While the Backdoors & Breaches card is featured for this topic, the post will provide context for understanding how an attacker can abuse this functionality and details that are useful in monitoring for such abuses.

Operating systems typically have features that allow an administrator or user to automatically execute commands during session initiation to ease the burden of administration in the context of a given environment. An attacker can take advantage of those features to execute commands of their own in order to gain initial access, establish persistence, or perform lateral movement.

This type of attack can be most devastating in the context of a corporate Active Directory environment. As a result, the discussion will center around the Microsoft Windows operating system. However, administrators and security analysts should realize that many of the capabilities we will be investigating are available in other operating systems and those vendor appliances installed on our networks.

In the context of this post, I consider a “Logon Script” any functionality that supports automated command execution during user session initialization. So, what techniques might an attacker try to obtain authentication-based execution?

  • Modification of registry keys
  • Local filesystem-based automated execution
  • Default domain logon script modification
  • Group policy modification
  • User object attribute modification

This surely is not an exhaustive list. However, it includes techniques that are most widely known and some things that we have encountered on recent engagements. Let’s explore each technique individually to more comprehensively understand it.

Modification of Registry Keys

This technique is age-old and highly instrumented by Antivirus and Endpoint Detection and Response tools. The Microsoft Windows registry contains several keys that can be used to execute content when the user logs onto the target host. The most widely discussed keys include:

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnceEx

In fact, there are many other options for execution and a comprehensive treatment can be found at https://attack.mitre.org/techniques/T1060/.

If an attacker is able to successfully modify one of the referenced keys successfully, the system will execute the target application each time the user authenticates.  

As an organization, it would be a wise investment to ensure that your chosen endpoint protection software identifies modification of the referenced registry keys to prevent abuse. In addition, it would be prudent to monitor for new registry keys used for this type of abuse.

Local Filesystem-based Automated Execution

When an attacker gains a “logon script” type automated execution using the local filesystem, the typical attack vector is the user or system’s startup folder. 

  • C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
  • C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

By default, the system startup folder is not writable by standard users. However, some organizations still grant local administrative permissions to their user populations. 

In any case, your chosen endpoint protection software should identify when these folders are modified. The contents of the folder should be monitored and investigated when changes do occur.

Default Domain Logon Script Modification

Probably the most widely understood “Logon Script” functionality is the use of scripts found in the \\<domain>\SYSVOL\Scripts share or an equivalent Group Policy Object that defines the Logon/Logoff script policy element.

An attacker can easily discover the target logon script by inspecting the Active Directory scriptPath attribute of user objects. 

In addition, the attacker can search the \\<domain>\SYSVOL\policies share for the presence of the Logon folder. 

Once the target scripts are discovered, the attacker can check those locations for the ability to write to the files. If write access is allowed, the attacker can use the script to attack anyone to which the logon script has been prescribed. Where write access is not allowed, the attacker can trace execution to determine whether additional scripts or binaries are called by the initial script and evaluate NTFS permissions in those locations.

As a result, the organization must periodically ensure that NTFS permissions set on domain login scripts and any branching locations are appropriately restricted.

Group Policy Modification

In this case, the attacker finds that their user account has permission to modify Group Policy Objects within the Group Policy hierarchy. 

With the ability to modify policy, the attacker has a number of options available to them. One of those options is to deploy their own logon script policy. In a recent engagement, this yielded administrative access on all computers where the policy was applied.

BloodHound is an excellent way to identify attack paths in this manner. When write access is identified on a GPO (GenericWrite or GenericAll) as a standard domain user, the organization should audit to ensure that permissions are properly restricted.

Furthermore, the organization should periodically audit permissions on all Group Policy Objects to ensure that permissions are correct.

User Object Attribute Modification

A similar condition arises when the attacker has control of a user with the ability to modify attributes of objects within the Active Directory schema. In the context of this post, the object type would be users. This vector is similar to the previous one. However, instead of modifying a Group Policy Object, the attacker simply modifies the ScriptPath attribute on the writable user account. 

The default location of logon scripts is the \\<domain>\SYSVOL\Scripts folder. However, this attribute will also happily accept any valid UNC path. As a result, the attacker can update the attribute to point to a writable share where a malicious script can be planted.

This is another area BloodHound can help identify issues that might allow privilege escalation within the environment. A path exhibiting this condition would show GenericWrite or GenericAll between a user or group node and another user.

To catalog and audit all Active Directory delegated permissions within your environment, you can use the PowerShell script below published by Netwrix.

https://raw.githubusercontent.com/thephoton/activedirectory-delegation-searcher/master/search.ps1

Conclusion

The ability to automatically execute scripts or commands during session initialization is a very powerful feature that decreases administrative burden on IT staff. However, an attacker who stumbles on an opportunity to abuse one of the techniques described above may have a significant opportunity to escalate privilege, move laterally, and persist within the environment. Knowing this, organizations need to pay very close attention to configuration changes within the environment and ensure that in-place protections are catching common abuses.



Ready to learn more?

Level up your skills with affordable classes from Antisyphon!

Pay-What-You-Can Training

Available live/virtual and on-demand