Injection and output handling
6 challengesEncode untrusted HTML, stop CRLF injection, and build dynamic SQL fragments from trusted outputs instead of raw input.
Hands-on application security in C#
Start from C# that is functionally correct and quietly exploitable. Patch the trust boundary, keep the feature working, and submit against real attack payloads across 20 focused challenges.
Five free previews. Authorized payloads. Nothing to install.
Normal tests cannot see the hole
Vulnerable code often passes every happy-path test. The difference appears only when an attacker supplies a traversal path, a private host, a forged log line, or an identifier shaped to escape the place you put it.
Katabench runs the ordinary suite and a separate adversarial suite. Blocking every input breaks the feature and fails. Preserving the feature while leaving one bypass open also fails. The defense has to hold both constraints at once.
Start with the OWASP Top 10 through a C# lens or read how the two suites are graded.
The adversarial suite
../../etc/passwd
path traversal
✓ denied
evil-example.com
suffix confusion
✓ rejected
http://169.254.169.254/
SSRF
✓ blocked
ada\n[INFO] admin granted
log forging
✓ escaped
Five secure-coding skill families
Each family repeats a code-level failure mode with different inputs and business behavior, so the defensive move becomes something you recognize before review finds it.
Encode untrusted HTML, stop CRLF injection, and build dynamic SQL fragments from trusted outputs instead of raw input.
Defend SSRF boundaries, CORS allowlists, redirect targets, link schemes, and hostname checks against inputs made to look almost safe.
Keep paths inside their root, reduce filenames to one safe segment, and accept only the content types the feature actually supports.
Block mass assignment, integer overflow, negative money flows, and resource-exhausting values without disabling the valid feature.
Return uniform account messages and safe errors so internal details and record existence do not leak through an otherwise working endpoint.
Free C# security exercises
Open a preview, inspect the working-but-vulnerable starter, and harden it until normal inputs still pass and the exploit payloads bounce. No project download or SDK setup is required.
Fix a stored-XSS hole in a comment renderer without breaking its output.
Open this challenge →Reduce an uploaded filename to a safe, single path segment.
Open this challenge →Stop user input from forging extra log lines with embedded newlines.
Open this challenge →Decide which submitted fields may be applied to a record using an allowlist, not a blocklist.
Open this challenge →Reject internal hosts so a user-supplied URL cannot make the server call itself or its neighbors.
Open this challenge →The defensive coding loop
01
The feature already works for normal input. Read the C# and find the trust boundary that lets a hostile value change what the program does.
02
Encode, validate, normalize, or allowlist at the right boundary. Removing the feature or rejecting every input does not count as a defense.
03
Submit against ordinary behavior tests and adversarial payloads. The solution passes only when the feature survives and the attack fails.
The goal is defensive judgment, not exploit tooling. Every payload is part of the authored exercise and runs only against your submitted code inside Katabench's isolated sandbox.
C# secure coding FAQ
They are small C# programs that behave correctly for normal input and fail at a security boundary. You repair the vulnerability, then functional tests and adversarial payloads verify that the feature still works and the exploit no longer does.
Many scenarios come from ASP.NET Core and API work, including HTML output, CORS origins, redirects, uploaded files, mass assignment, SQL fragments, SSRF, and safe error responses. Each exercise isolates the vulnerable C# boundary so the feedback stays focused.
They practice code-level failure modes related to several OWASP categories, including injection, SSRF, security misconfiguration, access-control boundaries, and data-integrity mistakes. They are not an OWASP certification course or a one-to-one checklist of every category.
Five challenges are free previews: HTML injection, filename sanitization, log forging, mass assignment, and SSRF host blocking. Katabench Pro unlocks all 20 secure-coding exercises and unlimited submissions.
No. These are defensive coding exercises inside Katabench's isolated sandbox. You modify the provided C# and submit it against authorized test payloads. The exercises never ask you to probe another system.
Yes. After trying the challenge, you can reveal a correct reference solution, inspect where it validates or encodes the input, then reset and implement the defense again. Daily reveal limits depend on your plan.
Start with the free HTML-injection challenge and let the functional plus adversarial suites tell you when the defense actually holds.
Try an XSS challenge freeA short note when fresh kata land, plus the C# and performance tricks behind the grading. No spam, unsubscribe anytime.