- About the author
- Threat modeling in 30 minutes
- Broken Access Control (A01:2025)
- Security Misconfiguration (A02:2025)
- Software Supply Chain Failures (A03:2025)
- Cryptographic Failures (A04:2025) (coming soon)
- Injection (A05:2025) (coming soon)
- Insecure Design (A06:2025) (coming soon)
- Authentication Failures (A07:2025) (coming soon)
- Software or Data Integrity Failures (A08:2025) (coming soon)
- Security Logging & Alerting Failures (A09:2025) (coming soon)
- Mishandling of Exceptional Conditions (A10:2025) (coming soon)
- Bonus: Securing AI features (coming soon)
- Case study: closing a pentest report, one commit at a time (coming soon)
- Appendix A: Cyber Resilience Act checklist for .NET teams (coming soon)
- Appendix B: Security in CI (coming soon)
- Appendix C: Security smells and the index of rules
Secure by Default, 2027 Edition
The OWASP Top 10 in ASP.NET Core 10, fixed one failing test at a time
In the age of AI-powered attacks, "nobody will find that endpoint" is no longer a security strategy. By the end of this book, you'll know how to close the OWASP Top 10 in your own code, with fixes and tests you can ship on Monday.
Minimum price
$15.00
$19.00
You pay
Author earns
About
About the Book
In the age of AI-powered attacks, "nobody will find that endpoint" is no longer a security strategy. By the end of this book, you'll know how to close the OWASP Top 10 in your own code, with fixes and tests you can ship on Monday.
In November 2025 Anthropic reported a cyber-espionage campaign in which an AI agent did "80-90% of the campaign", with human intervention "only sporadically" (https://www.anthropic.com/news/disrupting-AI-espionage). Automated attackers don't get bored and never skip an endpoint, and the holes they look for are the same ones pentesters have reported for years.
Someone just dropped a pentest report on your desk. Forty findings, a deadline, and a manager asking whether "it's bad". This book is for that week.
Secure by Default walks through the OWASP Top 10 (2025 edition) in ASP.NET Core 10 and C# 14, one risk per chapter, always in the same order:
- Why it matters, with a real, sourced incident, not a scary statistic made up for the occasion.
- The vulnerable code in VulnShop, a small but realistic minimal-API shop with EF Core and JWT authentication.
- The attack, step by step, with curl and
.httpfiles you can run yourself. - The fix, using the framework's own tools (authorization policies, Data Protection,
HttpClienthandlers, EF Core) instead of hand-rolled cleverness. - A test that fails on the vulnerable code and passes on the fix, so the bug can't quietly come back on the next Friday deploy.
- A checklist you can paste straight into your pull request template.
Every vulnerable line is marked // VULNERABLE and every fix // FIX, so you can run both versions side by side.
Who it's for
- Mid-level .NET developers (roughly 2-6 years) who know ASP.NET Core and now have to make it pass an audit, a pentest or a customer's security questionnaire.
- Senior developers and tech leads who want one shared reference for the team, with tests they can drop into CI.
Who it's not for: if you are just starting with C#, start with a beginner's book and come back in a year. This one assumes you already ship code to production (and have the scars to prove it).
What's inside
- Threat modeling in 30 minutes, without a three-day workshop
- A01 Broken Access Control: deny by default, policies, IDOR, SSRF
- A02 Security Misconfiguration: headers, CORS, HTTPS/HSTS, error pages, per-environment config
- A03 Software Supply Chain Failures: NuGet audit, lock files, package source mapping, SBOM
- A04 Cryptographic Failures: Data Protection, password hashing, secrets management
- A05 Injection: EF Core raw SQL, Dapper, XSS in Razor and Blazor, command injection
- A06 Insecure Design: rate limiting and business-logic abuse
- A07 Authentication Failures: Identity, passkeys, OIDC, JWT validation pitfalls, cookies
- A08 Software or Data Integrity Failures: safe deserialization, signed webhooks, CI/CD integrity
- A09 Security Logging & Alerting Failures: OpenTelemetry, Serilog, keeping secrets and PII out of logs
- A10 Mishandling of Exceptional Conditions: IExceptionHandler, ProblemDetails, failing closed
- Bonus: securing AI features built with Microsoft.Extensions.AI
- Appendices: a Cyber Resilience Act checklist for .NET teams, and security checks in CI
Written in public. The book is published while it's being written, about one chapter at a time. Buy it now and every new chapter and update is included at no extra cost. Early readers also get the lowest price: it goes up as the book grows.
Author
About the Author
Hi, I'm Matt. I've been writing .NET since 2016 and work as a senior backend software engineer, mostly on e-commerce platforms and business management systems: the kind of software nobody notices when it works, and everybody notices when it leaks.
I write practical, code-first books for .NET developers who have a pentest report on their desk and a deadline on their calendar. Every vulnerability is reproduced, fixed and locked in with a test.
When I'm not at the keyboard, I'm at a different one: piano, or a guitar.
Contents
Table of Contents
Get the free sample chapters
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.