# T1552 - Unsecured Credentials

## SOC Recommendation
Investigate Unsecured Credentials activity in the context of Credential Access: confirm scope, affected host/identity, and whether it matches expected administrative behaviour before deciding this is benign.

## D3FEND Mappings
| D3FEND Technique | Relationship | Practical SOC Action |
|---|---|---|
| File Analysis | Detect | Monitor for File Analysis indicators relevant to this technique. |
| File Encryption | Harden | Apply File Encryption to reduce this technique's viability before an incident occurs. |
| File Eviction | Evict | Use File Eviction to remove the adversary's foothold once this technique is confirmed. |
| Content Filtering | Isolate | Apply Content Filtering to contain the blast radius once this technique is observed. |

## Investigation Steps
1. Review Defender for Endpoint / Defender XDR alerts and timeline for the affected host or identity.
2. Check Sentinel analytics rules and incidents correlated with this technique.
3. Review Entra ID sign-in and audit logs if the technique involves an identity or cloud resource.

## Evidence to Collect
- Host or resource affected
- Account or identity involved
- Timestamp of the activity
- Related process, file, or network artifact
- Any preceding or follow-on alerts

## Response Actions
| Action | Risk | Automation Safe | Approval Required |
|---|---|---|---|
| Rotate any credentials that may have been exposed | Medium | No | Yes |
| Remediate the underlying misconfiguration — credentials shou | Low | No | Yes |
| Implement secrets management (Azure Key Vault, HashiCorp Vau | Low | No | Yes |

## KQL
```kql
DeviceProcessEvents
| where TimeGenerated >= ago(15m)
| where (FileName in~ ("findstr.exe", "rg.exe") and ProcessCommandLine has_any (
        "password", "passwd", "credential", "secret", "api_key", "apikey", "token", "connectionstring",
        "pwd=", "pass=", "username=", "user=", "login="
    ))
    or (FileName in~ ("cmd.exe", "powershell.exe") and ProcessCommandLine has_any (
        ".env", "credentials", "secrets.json", "accessTokens", "config.json", "web.config",
        ".aws/credentials", ".azure", "vault", "keystore"
    ) and ProcessCommandLine has_any ("type ", "cat ", "gc ", "Get-Content", "more "))
    or (FileName =~ "powershell.exe" and ProcessCommandLine has_any (
        "Get-ChildItem Env:", "[Environment]::GetEnvironmentVariable", "$env:", "dir env:"
    ) and ProcessCommandLine has_any ("password", "secret", "key", "token"))
| project
    TimeGenerated,
    DeviceName,
    AccountName,
    FileName,
    ProcessCommandLine,
    SHA256
| extend timestamp = TimeGenerated,
         HostCustomEntity = DeviceName,
         AccountCustomEntity = AccountName
| order by TimeGenerated desc
```
```kql
// change the starttime value for a longer period of known OIDs
let starttime = 1d;
// change the lookback value for a longer period of lookback for suspicious/abnormal
let lookback = 1h;
let OIDList = SecurityEvent
| where TimeGenerated >= ago(starttime)
| where EventSourceName == 'AD FS Auditing'
| where EventID == 501
| where EventData has '/eku'
| extend OIDs = extract_all(@"<Data>([\d+\.]+)</Data>", EventData)
| mv-expand OIDs
| extend OID = tostring(OIDs)
| extend OID_Length = strlen(OID)
| project TimeGenerated, Computer, EventSourceName, EventID, OID, OID_Length, EventData
;
OIDList
| where TimeGenerated >= ago(lookback)
| join kind=leftanti (
OIDList
| where TimeGenerated between (ago(starttime) .. ago(lookback))
| summarize by OID
) on OID
| extend HostName = tostring(split(Computer, ".")[0]), DomainIndex = toint(indexof(Computer, '.'))
| extend HostNameDomain = iff(DomainIndex != -1, substring(Computer, DomainIndex + 1), Computer)
```
```kql
Authomize_v2_CL
| where ingestion_time() >= ago(30m)
| extend EventID = id_s, Policy = policy_name_s, Severity = severity_s,Description = description_s,Recommendation = recommendation_s,URL = url_s,Tactics = tactics_s
| where Policy has "Password Exfiltration over SCIM application"
| project  EventID, Policy, Severity, Description, Recommendation, URL, Category, Tactics
```

## Escalation Criteria
- Unsecured Credentials activity observed on a privileged account or critical system.
- Activity follows or precedes other suspicious behaviour in the same investigation.
- Automated triage cannot confidently rule out malicious intent.

## False Positive Considerations
- Legitimate administrative or maintenance activity matching this pattern.
- Approved security testing or red team exercise.
- Known benign software producing similar telemetry.

Generated by SOC Response Atlas by Basyrix.
