8000 fix: incorrect id for 932230-58 by TimDiam0nd · Pull Request #4018 · coreruleset/coreruleset · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: incorrect id for 932230-58 #4018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 2, 2025
Merged

Conversation

TimDiam0nd
Copy link
Contributor
@TimDiam0nd TimDiam0nd commented Feb 25, 2025

The expect id for the test 932230-58 was set to 932130, when in fact it should be 932230.

It is more than probable that it was copy pasted from the test for 932130 but @Xhoenix possibly forgot to update it the expect ids (pr).

8000
The expect id for the test 932230-58 was set to 932130, when in fact it should be 932230.
It is more than probable that it was copy pasted from the test for 932130 but @Xhoenix forget to update it.
Relevant pr: coreruleset#3756
@theseion
Copy link
Contributor

Thanks @TimDiam0nd! Unfortunately, the test now fails.

@TimDiam0nd
Copy link
Contributor Author

Yep i did notice that. I did try looking into why it did not match, but unfortunately could find anything. Considering it is a duplicate of 932130-17, would you prefer I remove this?
Im not sure if @Xhoenix is able to provide any further context?

@Xhoenix
Copy link
Member
Xhoenix commented Feb 26, 2025

I think doing the same arithmetic expansion check in two places, i.e 932130 and 932230, is redundant. @TimDiam0nd see if you can remove the relevant code and tests for 932230.

Copy link
Contributor
github-actions bot commented Feb 26, 2025

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

@TimDiam0nd
Copy link
Contributor Author

@Xhoenix done (i think)

Copy link
Member
@Xhoenix Xhoenix left a comment

Choose a reason for hiding this comment

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

Looks good.

@fzipi
Copy link
Member
fzipi commented Feb 27, 2025

Is there any consequence on additional rules? This affects 932230, but also 932235, 932250, 932260, 932231, 932220, 932236, 932239, 932232 and 932238. No changes on params, transformation, anything particular that might be affected and not catched by 932130?

I would say we probably add tests to 932130 to be sure that we catch all the possible permutations or problems catches with the above rules to just be sure we are covered?

Also, as a followup Q: would rule 932130 catch additional evasion techniques that we might want to move away from the above rules to consolidate/simplify them?

@fzipi fzipi self-requested a review February 27, 2025 10:56
@Xhoenix
Copy link
Member
Xhoenix commented Feb 27, 2025

The rules are affected because they are indirectly using regex-assembly/include/unix-shell-evasion-prefix.ra, and instead of adding the prefix to that file, it'll be better if we simply catch the exact payload in 932130, especially for performance.

@fzipi
Copy link
Member
fzipi commented Feb 27, 2025

I agree. But can we be sure we are covered by adding tests?

@fzipi
Copy link
Member
fzipi commented Feb 27, 2025

Followup Q: is there any other prefix that we might benefit to remove if this is the case (maybe not for this PR, but I'm thinking on followups 😉 )

@theseion
Copy link
Contributor

I'm not comfortable with that change. I'd rather you modify the test to text arithmetic expansion for rule 932230 properly.

@TimDiam0nd
Copy link
Contributor Author
TimDiam0nd commented Feb 28, 2025

@Xhoenix

The rules are affected because they are indirectly using regex-assembly/include/unix-shell-evasion-prefix.ra, and instead of adding the prefix to that file, it'll be better if we simply catch the exact payload in 932130, especially for performance.

I believe that is already there:

##! arithmetic expansion (deprecated in bash, but exists in other shells, like zsh)
\$\[.*\]

@fzipi

I agree. But can we be sure we are covered by adding tests?

There is already a test in 932130 for the payload:

desc: "Bash - Arithmetic expansion ($[...])"
stages:
- input:
dest_addr: "127.0.0.1"
method: "GET"
port: 80
headers:
User-Agent: "OWASP CRS test agent"
Host: "localhost"
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
uri: "/get?932130-17=$%5B2%2B2%5D"

@theseion

I'm not comfortable with that change. I'd rather you modify the test to text arithmetic expansion for rule 932230 properly.

i.e. instead of removing the test from 932230, change it to no_expect_ids?

@theseion
Copy link
Contributor
theseion commented Mar 1, 2025

No, adjusting the payload so it triggers the rule:

  - test_id: 58
    desc: |
      Bash - Arithmetic expansion ($[...]).
      Payload: $[$(sh -c 'echo 1')+2]
    stages:
      - input:
          dest_addr: "127.0.0.1"
          method: "GET"
          port: 80
          headers:
            User-Agent: "OWASP CRS test agent"
            Host: "localhost"
            Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,ima>
          uri: "/get?932230-58=$%24%5B%24(sh%20-c%20'echo%201')%2B2%5D"
          version: "HTTP/1.1"
        output:
          log:
            expect_ids: [932230]

@Xhoenix
Copy link
Member
Xhoenix commented Mar 29, 2025

@TimDiam0nd Any updates on this?

@TimDiam0nd
Copy link
Contributor Author

Hey @Xhoenix sincere apologies for the delay on that, totally slipped my mind

@Xhoenix
Copy link
Member
Xhoenix commented Apr 1, 2025

@TimDiam0nd Can you revert the other changes, as the test is now correctly triggering rule 932230?

@TimDiam0nd TimDiam0nd force-pushed the 932230-58 branch 3 times, most recently from 73e3b14 to 36204e4 Compare April 1, 2025 20:40
@theseion theseion added this pull request to the merge queue Apr 2, 2025
@theseion
Copy link
Contributor
theseion commented Apr 2, 2025

Thanks @TimDiam0nd.

Merged via the queue into coreruleset:main with commit f462ac5 Apr 2, 2025
5 checks passed
@theseion theseion added the release:ignore Ignore for changelog release label Apr 2, 2025
@TimDiam0nd TimDiam0nd deleted the 932230-58 branch April 2, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:ignore Ignore for changelog release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0