They let an apparently normal dependency turn into a secret harvester only after trust has already been granted. That matters because browser credentials, API tokens and desktop sessions can be stolen without exploiting the application itself, which makes dependency trust a direct identity-security issue.
Why runtime-decrypted packages are dangerous to trust
Runtime-decrypted packages are dangerous because the package can look benign during review, then reveal malicious logic only when the application is already executing it. That timing matters for credentials and sessions: by the time the code decrypts itself, the browser, desktop app, or API client may already hold valid tokens, cookies, or other access material that the package can read and exfiltrate.
The core issue is trust inversion. Static inspection, signature checks, or repository review may see only an encrypted or obfuscated payload, while the real behaviour appears later under normal runtime conditions. For identity security, that means the package does not need to break the application itself, it only needs to operate where secrets are already present and where session state is already established.
That makes runtime decryption especially effective for stealing bearer-style material. A package that runs inside a browser or client process can often access in-memory state, local storage, injected headers, session cookies, refresh tokens, API keys, or cached authentication objects. Once those values are copied out, the attacker can reuse them elsewhere without needing the user to reauthenticate.
Why credentials and sessions are the easiest targets
Credentials and sessions are attractive because they collapse identity, authorization, and continuity into reusable material. A stolen password may still require additional steps, but a valid session cookie or access token can often be replayed immediately. Runtime-decrypted code is well positioned to capture that material at the moment it is most useful, after login, after federation, or after privileged action has already succeeded.
This is also why dependency trust is so important. When a package is imported or loaded, it inherits the surrounding application's permissions and runtime context. If that package decrypts its payload only after it is trusted, it can observe the same process memory, browser state, request flow, and session handling that the legitimate application uses. For readers who want the broader identity pattern, NHIMG’s Ultimate Guide to NHIs explains how credentials and other access material become security boundaries of their own.
In practice, the highest-risk cases are where the package runs close to interactive identity flows, such as browser extensions, desktop wrappers, CLI tooling, SDKs, and application plugins. Those environments often mix user sessions, service tokens, and cached secrets in one process boundary, which gives malicious code more than one path to capture useful material.
What defenders should look for in packages that decrypt at runtime
Runtime decryption is not automatically malicious, but it should raise the review bar. The security question is whether the package has a legitimate need to delay code disclosure, or whether the delay mainly obscures what it does. Packages that hide network destinations, decode strings just before use, or unpack additional payloads after startup deserve special scrutiny because they can turn a routine dependency into a secret-harvesting stage.
That risk is amplified when the package touches authentication libraries, HTTP clients, browser automation, or local secret stores. At that point, the behaviour is not merely generic obfuscation, it is a direct path to credential access and session replay. The relevant control objective is to stop untrusted dependency code from inheriting access to material it does not need.
For a practical baseline on protecting tokens and session material, Token and Session Security Guide is useful because it maps token theft and replay to the controls that reduce blast radius. For broader secret handling and lifecycle discipline, Secrets Management Guide shows why centralising and shortening secret lifetime matters once any dependency may be able to observe runtime state.
When a package is part of a supply chain risk path, LiteLLM PyPI package breach is a concrete example of how a dependency can become a credential theft vector rather than just a software delivery mechanism.
Risk and Threat Considerations
Runtime-decrypted packages create a hidden attack window because the malicious logic is deferred until after trust, loading, and privilege assignment have already happened. That makes them well suited to stealing reusable identity material quietly, especially where sessions or tokens are kept in memory, browser storage, or local caches.
Failure mechanism: The package decrypts or unpacks only at runtime, then reads secrets or session artifacts from the same process or browser context that was expected to execute trusted code.
Impact: Attackers can replay valid sessions, impersonate users or services, and exfiltrate credentials without needing to exploit the application logic itself.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and MITRE ATT&CK define the specific risk controls and attack patterns relevant to this topic.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 — Secret Leakage | Runtime-decrypted packages can exfiltrate credentials and tokens at execution time. |
| NHI-07 — Long-Lived Secrets | Sessions and tokens become easier to steal and reuse when they live too long. | |
| NHI-03 — Vulnerable Third-Party NHI | A dependency acting at runtime can become a third-party access path to identity material. | |
| Recommendation — Minimise secret exposure to untrusted runtime code and rotate any material it may reach. Shorten secret and session lifetimes to reduce replay value if a package is compromised. Assess third-party packages for runtime access to credentials before granting production trust. | ||
| MITRE ATT&CK | T1552 — Unsecured Credentials | The scenario centers on harvesting exposed credentials and session material. |
| T1528 — Steal Application Access Token | Runtime code can steal bearer tokens, cookies, and other application access material. | |
| Recommendation — Hunt for credential storage and access paths that a dependency could read at runtime. Protect application tokens from process-level read access and monitor for token theft. | ||
Practitioner Guidance
What to verify: Treat runtime decryption as a control question, not a curiosity. Verify whether the dependency truly needs to unpack executable logic late, whether it can reach authentication material, and whether its runtime permissions are broader than the function it claims to provide.
Decision rule: If a dependency can observe tokens, cookies, or secret-bearing memory, assume it can be used as a credential theft path and review it with the same seriousness as a direct compromise of the application boundary.
What good looks like: Secrets are not exposed to generic third-party runtime code, sessions are bound and short-lived where possible, and dependency behaviour is observable enough that unexpected decryption or network activity is detectable.
Practitioner takeaway: The real risk is not encryption inside the package, it is deferred execution inside a trusted context. Once the code runs where identity material already exists, the package no longer needs to break the system, it only needs to steal what the system has already accepted.
Related resources from NHI Mgmt Group
- Why do non-human identities create more risk than many human accounts?
- Why do non-human identities create more remediation risk than many human accounts?
- How should teams reduce the risk of exposed AI credentials being abused?
- What is the main risk when automation systems store ServiceNow credentials?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 12, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org