Where Secrets Really End Up in Docker Images: Testing 8 Common Methods
A comprehensive technical investigation examined exactly where secrets end up when building Docker images using eight different techniques. The tests used Ubuntu 24.04.1 LTS, Docker Engine 29.1.3, and BuildKit v0.26.2, with a test secret string SUPER_SECRET_KOTY_HULIGANY_2026 placed in various ways.
The first method, COPY, adds the secret file directly into an image layer. Even after running docker history, the file remains fully recoverable by extracting layers from a saved tar archive. Adding a subsequent RUN rm command only marks the file as deleted in a new layer; the original data stays intact in the previous layer.
Using ENV stores the secret value in the image configuration JSON under config.Env and also appears in build history. The ARG instruction keeps the value in history.created_by fields even though it does not appear in the final container environment.
The dedicated BuildKit Secrets feature, invoked with --mount=type=secret and --secret build flag, mounts the secret only temporarily during the RUN step. After the build completes, the value is absent from all layers, configuration JSON files, and history entries.
Multi-stage builds also proved effective when the secret is created and used only in an intermediate stage and never copied into the final image. No trace of the secret appears in the published artifact.
Combining echo and rm inside a single RUN instruction still leaves the secret string visible in build history and created_by metadata. Overwriting a copied file with a new value similarly fails because the original layer remains unchanged.
The experiments confirm that only two approaches — BuildKit Secrets and properly isolated multi-stage builds — avoid embedding secrets in the final Docker image. All other common patterns leave extractable data that can be recovered without ever starting a container.
Related articles
Uber Breach Exposes 149,000 Drivers After Third-Party Vendor Credentials Stolen
Uber has notified approximately 149,346 drivers that personal data was stolen in an October incident involving a compromised third-party vendor. Attackers used valid credentials belonging to the vendor to access data the ride-hailing company had shared with it, bypassing all security alerts because the access appeared legitimate. The affected information includes driver license images, names, addresses, dates of birth and government-issued identification numbers. The vendor was later identified as Fireworks AI, a cloud platform for running and fine-tuning open-source AI models. The same credential theft campaign had previously impacted Notion and Cursor. Uber immediately severed the connection upon discovery, notified regulators in multiple U.S. states, and is offering credit monitoring to affected individuals.
FBI Warns of ARTEX AI Pentest Framework Abused by Cybercriminals with Backdoored Docker Images
The FBI has issued an alert regarding the open-source ARTEX AI-powered penetration testing framework after it was observed in criminal operations targeting banks, governments, and technology companies since August 2026. Attackers achieved privileged access in under three hours in multiple incidents. The Cloud Security Alliance identified compromised Docker images containing a backdoor that executes root commands without authentication by exploiting a hidden CAPTCHA field value passed to sh -c. Approximately 9,000 downloads occurred from one malicious image, and 62 exposed consoles were found running the tampered version. Check Point reported 1,608 internet-exposed ARTEX consoles, including ten with exposed databases. The original GitHub repository was removed in October 2026, yet third-party copies and images continue to circulate. CERT-EU highlighted the lack of technical restrictions preventing out-of-scope actions by autonomous AI agents.
Optimizely Supply Chain Attack Infects BBC, CNN, HSBC and 177 Other Sites with Crypto-Stealing JavaScript
On November 16, visitors to major corporate websites received malicious JavaScript that swapped cryptocurrency wallet addresses and attempted to intercept banking card data. The code was distributed through Optimizely Web, a platform used for A/B testing. Researchers identified the malicious code in 188 scripts belonging to 178 organizations, including BBC, CNN, Fox News, HSBC, Equifax, Zoom, Salesforce, GitLab and IKEA. Attacker Scott Helm from Report URI reconstructed the attack timeline: adversaries modified the Project JavaScript field in client projects to load a file from an external domain while legitimate code continued to arrive from cdn.optimizely.com. The campaign began at 04:21 UTC on the BBC script and saw 26 payload updates throughout the day, including a card-data harvesting module added at 13:43 UTC. The malicious script could not access Stripe or Adyen payment forms inside iframes but attempted iOS exploit chains Coruna and DarkSword on affected devices. Optimizely confirmed the breach resulted from a vulnerability in Experimentation account registration, closed the flaw, removed the code and notified customers. Content Security Policy blocked the payload on only 24 of 256 tested sites, and attackers collected roughly $7,040 in cryptocurrency before cleanup completed around 21:52 UTC.
Rspamd 4.3.0 Released with Improved Phishing Detection, Attachment Scanning and Authentication Hardening
In mid-November 2026, developer Vsevolod Stakhov released Rspamd 4.3.0, the latest version of the open-source spam filtering system written in C, C++ and Lua under the Apache 2.0 license. The update strengthens HTTP connection handling, URL-based phishing checks, SPF/DKIM/ARC authentication validation and SMTPUTF8 address parsing while adding more robust attachment and HTML analysis. Key improvements include separate scoring for displayed versus actual link destinations, stricter rejection of weak DKIM keys and duplicate tags, and better archive filename handling to prevent executable hiding. The release also introduces the HTML_TINY_PIXEL_TRACKER rule to detect tracking beacons and fixes multiple bugs that could cause worker crashes or memory issues after free. Several changes may require configuration adjustments for existing users, particularly around symbol options and stricter authentication policies. Rspamd continues to support high-throughput Milter integration with Postfix and Sendmail while offering an extensive Lua API for custom processing logic.