Dev/new pattern sshd logs for synology#1798
Conversation
|
@crowdsecurity/team-hub , @dimatha , @maximelouet , @buixor , @sabban Could you please review this PR ? |
12f3e98 to
b002c0d
Compare
…ynology machines - Add a pattern log detection into sshd parser and scenario SSH BF specific to invalid users Synology DSM 7.x logs formats
- Updated a pattern log detection into synology-dsm-logs parser specific to invalid users Synology DSM 7.x logs formats
b002c0d to
560f448
Compare
| state: open | ||
| - name: Comment PR if errors | ||
| if: ${{ (env.taxonomy_errors == '1') && (github.event_name == 'push') && (github.ref != 'refs/heads/master') }} | ||
| if: ${{ (env.taxonomy_errors == '1') && (github.event_name == 'push') && (github.ref != 'refs/heads/master') && (steps.findPr.outputs.pr != 'false') }} |
There was a problem hiding this comment.
Yes. Due to a taxonomy check inherited from https://github.com/lachapette/crowdsecurity-hub/tree/dependabot/uv/uv-c30c77f42d
I don't know how to bypass it.
| state: open | ||
| - name: Comment PR if errors | ||
| if: ${{ (env.taxonomy_errors == '1') && (github.event_name == 'push') && (github.ref != 'refs/heads/master') }} | ||
| if: ${{ (env.taxonomy_errors == '1') && (github.event_name == 'push') && (github.ref != 'refs/heads/master') && (steps.findPr.outputs.pr != 'false') }} |
There was a problem hiding this comment.
Yes. Due to a taxonomy check inherited from https://github.com/lachapette/crowdsecurity-hub/tree/dependabot/uv/uv-c30c77f42d
I don't know how to bypass it.
| @@ -0,0 +1 @@ | |||
| len(results) == 0 No newline at end of file | |||
There was a problem hiding this comment.
This file being empty for a scenario test likely means your scenario did not work as expected.
There was a problem hiding this comment.
It works on runtime but i can't push it with scenario success due slow bruteforce in logs above several hours. It does not work in tests scenarios. If there is a way tell me i will rework it.
| SSHD_AUTH_FAIL: 'pam_%{DATA:pam_type}\(sshd:auth\): authentication failure; logname= uid=%{NUMBER:uid}? euid=%{NUMBER:euid}? tty=ssh ruser= rhost=%{IP_WORKAROUND:sshd_client_ip}( %{SPACE}user=%{USERNAME:sshd_invalid_user})?' | ||
| SSHD_MAGIC_VALUE_FAILED: 'Magic value check failed \(\d+\) on obfuscated handshake from %{IP_WORKAROUND:sshd_client_ip} port \d+' | ||
| SSHD_INVALID_USER: 'Invalid user\s*%{USERNAME:sshd_invalid_user}? from %{IP_WORKAROUND:sshd_client_ip}( port \d+)?' | ||
| SSHD_INVALID_USER_SYNO: 'pam_%{DATA:pam_type}\(sshd:auth\): Can.t get user uid \(%{USERNAME:sshd_invalid_user}\)' |
There was a problem hiding this comment.
Looks like there's a typo in the pattern: can.t vs can't.
The logs you provided for the tests are using can't.
There was a problem hiding this comment.
i didn't succeeded to escape ' character in the regex as it is enclosed by 2 ' characters so i match it with a dot. There is not impact.
| expression: "evt.Parsed.src_ip" | ||
| - meta: service | ||
| value: synology-dsm | ||
| - meta: source_ip |
There was a problem hiding this comment.
Don't move the statics, if we ever add another pattern in the file, we would need to move them back on top level
| @@ -0,0 +1,18 @@ | |||
| # Synology DSM auth.log bruteforce | |||
| type: leaky | |||
| name: crowdsecurity/synology-dsm-bf-slow-1h | |||
There was a problem hiding this comment.
Don't use the crowdsecurity namespace.
There was a problem hiding this comment.
Ok i can create a new namespace but it will be duplicated for further maintainability ?
There was a problem hiding this comment.
Same reason as above due to classification error string expected instead of list when running tests.
There was a problem hiding this comment.
This is automated style fixing IDE (IntelliJ). i can revert it.
There was a problem hiding this comment.
Yes same root cause due to taxonomy MR with dependency bot.
There was a problem hiding this comment.
is a mistake i guess. You want it reverted or in another MR ?
Description
Add Synology-specific patterns and tests for invalid user authentication (SSH and DSM logs API)
Impact: Enhances detection of brute force attacks on Synology devices (SSH and DSM API) with patterns specific to Synology DSM 7.x log formats.
1. SSH Parser (sshd-logs.yaml)
New pattern for Synology DSM 7.x:
2. DSM Parser (synology-dsm-logs.yaml)
Updated Pattern:
3. New Scenario
synology-dsm-bf-slow-1h.yaml:
4. Tests Added
config.yaml,parser.assert(760 lines),scenario.assert,synology-dsm-ssh-bf.log(21 lines)config.yaml,parser.assert(829 lines),scenario.assert(49 lines),synology-dsm-logs-bf-slow.log(61 lines)parser.assert(+65 lines) andsynology-dsm-logs.log(+5 lines)Checklist