Skip to content

πŸ›‘οΈ Sentinel: [MEDIUM] Fix Boolean Type Confusion (CWE-843) - #127

Open
ManupaKDU wants to merge 1 commit into
mainfrom
sentinel/fix-boolean-type-confusion-1867502310169586486
Open

πŸ›‘οΈ Sentinel: [MEDIUM] Fix Boolean Type Confusion (CWE-843)#127
ManupaKDU wants to merge 1 commit into
mainfrom
sentinel/fix-boolean-type-confusion-1867502310169586486

Conversation

@ManupaKDU

Copy link
Copy Markdown
Contributor

🚨 Severity: MEDIUM

πŸ’‘ Vulnerability: Python's bool type inherently subclasses int. When passed to standard library modules like ipaddress which internally use isinstance(var, int), True and False successfully evaluate to integers 1 and 0 respectively. This leads to unexpected type confusion vulnerabilities, bypassing numeric boundary restrictions set earlier in logic flows.

🎯 Impact: Potential logic bypasses (where boolean flags accidentally act as numeric durations for process limits) and implicit network state changes (e.g., 0.0.0.0 being processed directly as an IP). Though currently blocked downstream by defense-in-depth SSRF constraints, relying on late-stage validators for early-stage Type Confusion bypasses is a significant risk.

πŸ”§ Fix: Added explicit type(var) is bool rejections for arbitrary polymorphic inputs prior to them being routed to int() casting or ipaddress.ip_address evaluation.

βœ… Verification: Unit tests test_is_reachable_type_confusion_bool asserting that True is correctly blocked and logged as an invalid boolean prior to hitting subprocess/ipaddress calls. All unit tests successfully pass locally (python -m unittest test_testping1.py).


PR created automatically by Jules for task 1867502310169586486 started by @ManupaKDU

- Added explicit `type(x) is bool` rejection to `ip` and `timeout` parameters.
- Prevents `True` evaluating as `0.0.0.1` and `False` as `0.0.0.0` bypassing initial numeric constraints inside Python's ipaddress module.
- Added explicit test cases catching boolean injection attempts.

Co-authored-by: ManupaKDU <95234271+ManupaKDU@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant