Skip to content

Conversation

@Elnadrion
Copy link
Contributor

This patch refines rule 953100 (PHP leakage) by removing overly broad markers (HY000, HY093, HY105, IM001) from php-errors.data and replacing them with context-aware signatures:

  • SQLSTATE[HY000], (HY000/
  • SQLSTATE[HY093]
  • SQLSTATE[HY105]
  • SQLSTATE[IM001]

These patterns align with real PDO/ODBC error messages while eliminating false positives caused by random substrings in response bodies (e.g. I had tokens like hazhhy0004,sim001a). This improves detection accuracy without weakening coverage of genuine leakage events.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2025

📊 Quantitative test results for language: eng, year: 2023, size: 10K, paranoia level: 1:
🚀 Quantitative testing did not detect new false positives

@fzipi
Copy link
Member

fzipi commented Sep 4, 2025

Hi @Elnadrion! Thanks for your contribution!

@fzipi
Copy link
Member

fzipi commented Sep 4, 2025

Question: wouldn't this be caught by

instead?

@Elnadrion
Copy link
Contributor Author

Question: wouldn't this be caught by


instead?

Sure, I think it would. Should I remove my SQLSTATE rows then, or just replace them with SQLSTATE[? Or is it enough to just have them in sql-errors.data?

@Elnadrion
Copy link
Contributor Author

Alrighty, I simplified the pattern and removed unnecessary tests 👍

@fzipi
Copy link
Member

fzipi commented Sep 4, 2025

Thanks for taking a second look. One of the things that I'm not 100% sure is the utility of those errors in the PHP leakage 🤔

This is a file that I've created automatically from the PHP source code, and tried to remove nonsense from it.

See https://github.com/coreruleset/coreruleset/blob/main/rules/php-errors.data#L1-L30. I'm maybe more inclined to do

# Anything that is too short, or nonsense, we remove.
😄 . The SQLSTATE would be covered by 951100 rule.

What do you think?

@Elnadrion
Copy link
Contributor Author

Yeah, why not, also totally fine for me.
Anything, just to get rid of this nasty false positive 😄

@Elnadrion Elnadrion changed the title fix(953100): tighten SQLSTATE matching to avoid substring false positives fix(953100): remove generic SQLSTATE error codes causing false positives Sep 5, 2025
Copy link
Member

@fzipi fzipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for taking a look!

@fzipi fzipi added this pull request to the merge queue Sep 8, 2025
Merged via the queue into coreruleset:main with commit 6a6e3cd Sep 8, 2025
7 checks passed
@fzipi fzipi mentioned this pull request Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants