[NEW QUERY] Detect global SSL certificate validation bypass in C##2
Open
[NEW QUERY] Detect global SSL certificate validation bypass in C##2
Conversation
- Detects when ServicePointManager.ServerCertificateValidationCallback is set to always return true - Identifies lambda expressions and method references that unconditionally return true - Prevents man-in-the-middle attacks by flagging disabled SSL certificate validation - Includes comprehensive test cases covering lambdas, delegates, and expression-bodied methods - CWE-295: Improper Certificate Validation - Security severity: 8.1 (High)
Addressed code review feedback - removed unused method that was defined but never called.
Copilot
AI
changed the title
[WIP] Fix global SSL configuration to prevent always returning true
[NEW QUERY] Detect global SSL certificate validation bypass in C#
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Query Information
csharp/web/insecure-ssl-validation🎯 Description
What This Query Detects
Assignments to
ServicePointManager.ServerCertificateValidationCallbackthat unconditionally returntrue, disabling SSL/TLS certificate validation globally and exposing all HTTPS requests to MITM attacks.Example Vulnerable Code
Example Safe Code
🧪 Testing
📋 Checklist
.mdand.qhelp)🔗 References
Note: This query was developed using Test-Driven Development methodology.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.