T1059 / TECHNIQUE
Command and Scripting Interpreter
Adversaries may abuse command and script interpreters to execute commands, scripts, or binaries. These interfaces and languages provide ways of interacting with computer systems and are a common feature across many different platforms. Most systems come with some built-in command-line interface and scripting capabilities, for example, macOS and Linux distributions include some flavor of Unix Shell while Windows installations include the Windows Command Shell and PowerShell. There are also cross-platform interpreters such as Python, as well as those commonly associated with client applications such as JavaScript and Visual Basic. Adversaries may abuse these technologies in various ways as a means of executing arbitrary commands. Commands and scripts can be embedded in Initial Access payloads delivered to victims as lure documents or as secondary payloads downloaded from an existing C2. Adversaries may also execute commands through interactive terminals/shells, as well as utilize various Remote Services in order to achieve remote Execution.
- Category
- ATT&CK Enterprise
- Version / scope
- ATT&CK 20.1; object 2.7
- Affected / relevant technologies
- Containers / ESXi / IaaS / Identity Provider / Linux / macOS / Network Devices / Office Suite / SaaS / Windows
- Evidence
- Documentation: pinned-source excerpt checked. Execution: not tested. Editorial: curated reference.
Defensive analysis and explicitly authorized assessment only. This website performs no scans, exploitation, model calls or infrastructure changes. Indicators below are investigation opportunities, not proof of compromise or guaranteed detectors.
Mechanism and prerequisites
Assess the documented platform and access context with the asset owner. This is a descriptive reference, not an execution recipe.
Potential impact
Publisher tactic context: execution
Versioned source scope
This record contains normalized, sometimes shortened source excerpts with editorial safety context. Markup and executable example blocks are omitted. Source-field verification does not establish device testing, a working detector or local applicability.
Publisher: MITRE. Release: ATT&CK 20.1; object 2.7. Source checked: 2026-11-18.
Source object: attack-pattern--7385dfaf-6886-4229-9ecd-6fd678040830. Object created: 2017-05-31T21:30:49.546Z. Object modified: 2026-05-12T15:12:00.641Z.
Attribution and source terms (© The MITRE Corporation; reproduced with permission)Detection and investigation
- Detects the execution of scripting or command interpreters (e.g., powershell.exe, cmd.exe, wscript.exe) outside expected administrative time windows or from abnormal user contexts, often followed by encoded/obfuscated arguments or secondary execution events.
- Detects use of shell interpreters (e.g., bash, sh, python, perl) initiated by users or processes not normally executing them, especially when chaining suspicious utilities like netcat, curl, or ssh.
- Detects launch of command-line interpreters via Terminal, Automator, or hidden osascript, especially when parent process lineage deviates from user-initiated applications.
- Detects use of 'esxcli system' or direct interpreter commands (e.g., busybox shell) invoked from SSH or host terminal unexpectedly.
Preserve source timestamps, asset identity and collection context. Correlate independent evidence before attributing malicious intent. In OT, review passive evidence with the process owner; do not induce failures, replay commands or write to controllers to test a hypothesis.
Mitigation and response
- Restrict Web-Based Content: Restricting web-based content involves enforcing policies and technologies that limit access to potentially malicious websites, unsafe downloads, and unauthorized browser behaviors. This can include URL filtering, download restrictions, script blocking, and extension control to protect against exploitation, phishing, and malware delivery. This mitigation can be implemented through the following measures: Deploy Web Proxy Filtering: - Use solutions to filter web traffic based on categories, reputation, and content types. - Enforce policies that block unsafe websites or file types at the gateway level. Enable DNS-Based Filtering: - Implement tools to restrict access to domains associated with malware or phishing campaigns. - Use public DNS filtering services to enhance protection. Enforce Content Security Policies (CSP): - Configure CSP headers on internal and external web applications to restrict script execution, iframe embedding, and cross-origin requests. Control Browser Features: - Disable unapproved browser features like automatic downloads, developer tools, or unsafe scripting. - Enforce policies through tools like Group Policy Management to control browser settings. Monitor and Alert on Web-Based Threats: - Use SIEM tools to collect and analyze web proxy logs for signs of anomalous or malicious activity. - Configure alerts for access attempts to blocked domains or repeated file download failures.
- Privileged Account Management: Privileged Account Management focuses on implementing policies, controls, and tools to securely manage privileged accounts (e.g., SYSTEM, root, or administrative accounts). This includes restricting access, limiting the scope of permissions, monitoring privileged account usage, and ensuring accountability through logging and auditing.This mitigation can be implemented through the following measures: Account Permissions and Roles: - Implement RBAC and least privilege principles to allocate permissions securely. - Use tools like Active Directory Group Policies to enforce access restrictions. Credential Security: - Deploy password vaulting tools like CyberArk, HashiCorp Vault, or KeePass for secure storage and rotation of credentials. - Enforce password policies for complexity, uniqueness, and expiration using tools like Microsoft Group Policy Objects (GPO). Multi-Factor Authentication (MFA): - Enforce MFA for all privileged accounts using Duo Security, Okta, or Microsoft Azure AD MFA. Privileged Access Management (PAM): - Use PAM solutions like CyberArk, BeyondTrust, or Thycotic to manage, monitor, and audit privileged access. Auditing and Monitoring: - Integrate activity monitoring into your SIEM (e.g., Splunk or QRadar) to detect and alert on anomalous privileged account usage. Just-In-Time Access: - Deploy JIT solutions like Azure Privileged Identity Management (PIM) or configure ephemeral roles in AWS and GCP to grant time-limited elevated permissions. Tools for Implementation Privileged Access Management (PAM): - CyberArk, BeyondTrust, Thycotic, HashiCorp Vault. Credential Management: - Microsoft LAPS (Local Admin Password Solution), Password Safe, HashiCorp Vault, KeePass. Multi-Factor Authentication: - Duo Security, Okta, Microsoft […]
- Limit Software Installation: Prevent users or groups from installing unauthorized or unapproved software to reduce the risk of introducing malicious or vulnerable applications. This can be achieved through allowlists, software restriction policies, endpoint management tools, and least privilege access principles. This mitigation can be implemented through the following measures: Application Whitelisting - Implement Microsoft AppLocker or Windows Defender Application Control (WDAC) to create and enforce allowlists for approved software. - Whitelist applications based on file hash, path, or digital signatures. Restrict User Permissions - Remove local administrator rights for all non-IT users. - Use Role-Based Access Control (RBAC) to restrict installation permissions to privileged accounts only. Software Restriction Policies (SRP) - Use GPO to configure SRP to deny execution of binaries from directories such as %AppData%, %Temp%, and external drives. - Restrict specific file types (.exe, .bat, .msi, .js, .vbs) to trusted directories only. Endpoint Management Solutions - Deploy tools like Microsoft Intune, SCCM, or Jamf for centralized software management. - Maintain a list of approved software, versions, and updates across the enterprise. Monitor Software Installation Events - Enable logging of software installation events and monitor Windows Event ID 4688 and Event ID 11707 for software installs. - Use SIEM or EDR tools to alert on attempts to install unapproved software. Implement Software Inventory Management - Use tools like OSQuery or Wazuh to scan for unauthorized software on endpoints and servers. - Conduct regular audits to detect and remove unapproved software. Tools for Implementation Application Whitelisting: - Microsoft AppLocker - Windows Defender […]
- Execution Prevention: Prevent the execution of unauthorized or malicious code on systems by implementing application control, script blocking, and other execution prevention mechanisms. This ensures that only trusted and authorized code is executed, reducing the risk of malware and unauthorized actions. This mitigation can be implemented through the following measures: Application Control: - Use Case: Use tools like AppLocker or Windows Defender Application Control (WDAC) to create whitelists of authorized applications and block unauthorized ones. On Linux, use tools like SELinux or AppArmor to define mandatory access control policies for application execution. - Implementation: Allow only digitally signed or pre-approved applications to execute on servers and endpoints. (e.g., New-AppLockerPolicy -PolicyType Enforced -FilePath "C:\Policies\AppLocker.xml") Script Blocking: - Use Case: Use script control mechanisms to block unauthorized execution of scripts, such as PowerShell or JavaScript. Web Browsers: Use browser extensions or settings to block JavaScript execution from untrusted sources. - Implementation: Configure PowerShell to enforce Constrained Language Mode for non-administrator users. (e.g., Set-ExecutionPolicy AllSigned) Executable Blocking: - Use Case: Prevent execution of binaries from suspicious locations, such as %TEMP% or %APPDATA% directories. - Implementation: Block execution of .exe, .bat, or .ps1 files from user-writable directories. Dynamic Analysis Prevention: - Use Case: Use behavior-based execution prevention tools to identify and block malicious activity in real time. - Implemenation: Employ EDR solutions that analyze runtime behavior and block suspicious code execution.
Apply changes through the asset owner's approved change and recovery process. Documentation review is separate from successful testing or verified production protection.
Related technical context
No protocol-specific mapping is asserted for this entry.
Related security reading
Continue directly to another reference. Editorial reading connections do not assert official CWE/CAPEC/ATT&CK/OWASP equivalence or mappings.
Publisher-defined relationships
These directed relationships come from the pinned publisher data. They describe framework context, not guaranteed prevention, detection coverage or equivalence between entities.
- DET0516 → detects → T1059: Behavioral Detection of Command and Scripting Interpreter Abuse
- M1026 → mitigates → T1059: Privileged Account Management
- M1047 → mitigates → T1059: Audit
- T1059.005 → subtechnique-of → T1059: Visual Basic
- T1059.002 → subtechnique-of → T1059: AppleScript
- M1033 → mitigates → T1059: Limit Software Installation
- T1059.003 → subtechnique-of → T1059: Windows Command Shell
- M1045 → mitigates → T1059: Code Signing
- T1059.013 → subtechnique-of → T1059: Container CLI/API
- T1059.004 → subtechnique-of → T1059: Unix Shell
- T1059.010 → subtechnique-of → T1059: AutoHotKey & AutoIT
- M1042 → mitigates → T1059: Disable or Remove Feature or Program
- T1059.008 → subtechnique-of → T1059: Network Device CLI
- T1059.012 → subtechnique-of → T1059: Hypervisor CLI
- M1038 → mitigates → T1059: Execution Prevention
- M1049 → mitigates → T1059: Antivirus/Antimalware
- T1059.006 → subtechnique-of → T1059: Python
- T1059.001 → subtechnique-of → T1059: PowerShell
- M1021 → mitigates → T1059: Restrict Web-Based Content
- T1059.009 → subtechnique-of → T1059: Cloud API
- M1040 → mitigates → T1059: Behavior Prevention on Endpoint
- T1059.011 → subtechnique-of → T1059: Lua
- T1059.007 → subtechnique-of → T1059: JavaScript
Authoritative sources and attribution
Identifiers and source titles belong to OWASP, MITRE, the CVE Program, CISA, NIST or the cited vendor. Source excerpts are attributed and adapted under the linked publisher license; editorial context is separate. This is not an official framework mirror. Review baseline: 2026-11-18. Live documents can change; check exact current applicability.
- Publisher reference: T1059 — source accessed 2026-11-18
- enterprise — source accessed 2026-11-18
Source review supports bounded reference text. It is not execution evidence, a completeness claim, a CVSS assessment, a compliance certification or verification of production security.
