<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rust Security in Production on Atharva Pandey</title><link>https://atharva.page/series/rust-security-in-production/</link><description>Recent content in Rust Security in Production on Atharva Pandey</description><generator>Hugo</generator><language>en-us</language><copyright>Copyright ©</copyright><lastBuildDate>Sun, 18 May 2025 13:29:00 +0000</lastBuildDate><atom:link href="https://atharva.page/series/rust-security-in-production/index.xml" rel="self" type="application/rss+xml"/><item><title>Lesson 8: Security Fuzzing — Finding vulnerabilities before attackers do</title><link>https://atharva.page/post/rust/rust-sec-fuzzing-security/</link><pubDate>Sun, 18 May 2025 13:29:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-fuzzing-security/</guid><description>&lt;p&gt;I found a panic in a production parser by accident last year. A user in Japan sent a request with a multi-byte UTF-8 character right at a boundary where our code was slicing a string by byte index. It worked fine for ASCII. It worked fine for most Unicode. But this particular combination of character and position triggered an index-out-of-bounds panic that crashed the request handler.&lt;/p&gt;
&lt;p&gt;I fixed the bug in ten minutes. What bothered me was that we&amp;rsquo;d had unit tests, integration tests, and even some property-based tests — and none of them caught it. The input space was too large. The edge case was too specific. A human writing test cases would never think to put a 3-byte UTF-8 character at exactly that offset.&lt;/p&gt;</description></item><item><title>Lesson 7: Sandboxing and Privilege Dropping — Least privilege</title><link>https://atharva.page/post/rust/rust-sec-sandboxing/</link><pubDate>Thu, 15 May 2025 07:41:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-sandboxing/</guid><description>&lt;p&gt;Here&amp;rsquo;s a pattern I&amp;rsquo;ve seen too many times: a Rust web service runs as root in a Docker container because &amp;ldquo;it needs to bind port 443.&amp;rdquo; The service handles user uploads, parses JSON, processes images, and talks to a database — all with root privileges. If any part of that pipeline has a vulnerability, the attacker gets root on the container. And if the container isn&amp;rsquo;t properly isolated, they might get the host too.&lt;/p&gt;</description></item><item><title>Lesson 6: Supply Chain Security — Lockfiles, vendoring, and trust</title><link>https://atharva.page/post/rust/rust-sec-supply-chain/</link><pubDate>Mon, 12 May 2025 10:08:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-supply-chain/</guid><description>&lt;p&gt;The xz backdoor was a wake-up call for the entire industry, but honestly, supply chain attacks had been happening for years before that — just more quietly. Typosquatting on npm, malicious PyPI packages, compromised maintainer accounts. The question isn&amp;rsquo;t whether Rust&amp;rsquo;s ecosystem is vulnerable to supply chain attacks. It is. The question is what you&amp;rsquo;re doing about it.&lt;/p&gt;
&lt;p&gt;I spent a week last year hardening our build pipeline after we realized that a &lt;code&gt;cargo build&lt;/code&gt; on our CI server was pulling fresh crate downloads from the internet with no verification beyond what Cargo does by default. If crates.io got compromised, or if our DNS got hijacked, we&amp;rsquo;d be compiling and shipping attacker code with zero friction.&lt;/p&gt;</description></item><item><title>Lesson 5: Dependency Auditing — cargo-audit and cargo-deny</title><link>https://atharva.page/post/rust/rust-sec-dependency-audit/</link><pubDate>Fri, 09 May 2025 14:55:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-dependency-audit/</guid><description>&lt;p&gt;You know what keeps me up at night? Not my own code — I can review that. It&amp;rsquo;s the 200+ transitive dependencies in my &lt;code&gt;Cargo.lock&lt;/code&gt; that I&amp;rsquo;ve never read a single line of. Every one of those crates runs with the same permissions as my code. If any of them has a vulnerability, it&amp;rsquo;s my vulnerability.&lt;/p&gt;
&lt;p&gt;This isn&amp;rsquo;t theoretical. In 2024, the &lt;code&gt;xz&lt;/code&gt; backdoor showed that even core infrastructure maintained by a single person can be compromised. Rust&amp;rsquo;s ecosystem isn&amp;rsquo;t immune. We&amp;rsquo;ve had actual advisories for real crates — buffer overflows in parsing libraries, unsound &lt;code&gt;unsafe&lt;/code&gt; code in popular crates, logic bugs in crypto implementations.&lt;/p&gt;</description></item><item><title>Lesson 4: Secret Management — zeroize and secure memory</title><link>https://atharva.page/post/rust/rust-sec-secrets/</link><pubDate>Wed, 07 May 2025 08:23:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-secrets/</guid><description>&lt;p&gt;A while back I was debugging a crash in production and pulled a core dump from the server. Sitting right there in the heap, in plain text, was a database connection string with credentials. The service had loaded the secret from Vault on startup, stored it in a regular &lt;code&gt;String&lt;/code&gt;, and that &lt;code&gt;String&lt;/code&gt; stayed in memory for the entire process lifetime. When it crashed, the secret got written to disk in the core dump.&lt;/p&gt;</description></item><item><title>Lesson 3: Cryptography — ring, RustCrypto, and sodiumoxide</title><link>https://atharva.page/post/rust/rust-sec-crypto/</link><pubDate>Mon, 05 May 2025 11:47:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-crypto/</guid><description>&lt;p&gt;I&amp;rsquo;m going to say something controversial: most developers should never write cryptographic code. Not because they&amp;rsquo;re not smart enough — because the field is absurdly hostile to even tiny mistakes. A single branch in your constant-time comparison function leaks timing information. A reused nonce in AES-GCM completely destroys confidentiality. An ECDSA implementation with a biased random number generator leaks your private key after enough signatures.&lt;/p&gt;
&lt;p&gt;But you still need to &lt;em&gt;use&lt;/em&gt; cryptography. Every production system needs hashing, encryption, signatures, or key derivation at some point. The trick is picking the right library, using it correctly, and understanding just enough of the theory to avoid the common footguns.&lt;/p&gt;</description></item><item><title>Lesson 2: Input Validation and Sanitization — Trust nothing</title><link>https://atharva.page/post/rust/rust-sec-input-validation/</link><pubDate>Sat, 03 May 2025 16:12:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-input-validation/</guid><description>&lt;p&gt;A few months ago, I was reviewing a PR where someone had written a REST API handler that took a user-supplied filename, appended it to a base path, and opened the file. The code compiled perfectly. Clippy was happy. Tests passed. And it was a textbook path traversal vulnerability — &lt;code&gt;../../etc/passwd&lt;/code&gt; would work just fine.&lt;/p&gt;
&lt;p&gt;Rust&amp;rsquo;s type system protects you from memory corruption. It doesn&amp;rsquo;t protect you from trusting user input. That&amp;rsquo;s still on you. And honestly? It&amp;rsquo;s where most production vulnerabilities in Rust code are going to come from.&lt;/p&gt;</description></item><item><title>Lesson 1: Memory Safety — What Rust gives you for free</title><link>https://atharva.page/post/rust/rust-sec-memory-safety/</link><pubDate>Thu, 01 May 2025 09:34:00 +0000</pubDate><guid>https://atharva.page/post/rust/rust-sec-memory-safety/</guid><description>&lt;p&gt;Last year I inherited a C++ service that had been &amp;ldquo;battle-tested&amp;rdquo; in production for three years. Within a week of digging through crash dumps, I found two use-after-free bugs, a buffer overread that leaked heap data into API responses, and a data race in the connection pool that only triggered under load. Three years. Battle-tested. Right.&lt;/p&gt;
&lt;p&gt;That experience is what finally pushed me from &amp;ldquo;Rust is interesting&amp;rdquo; to &amp;ldquo;Rust is non-negotiable for anything touching the network.&amp;rdquo; The memory safety guarantees aren&amp;rsquo;t just a nice-to-have — they&amp;rsquo;re the single biggest security win you get by choosing Rust.&lt;/p&gt;</description></item></channel></rss>