-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Enip rust 3958 v5 #9937
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
Closed
Closed
Enip rust 3958 v5 #9937
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,143 @@ | ||
| ENIP/CIP Keywords | ||
| ================= | ||
|
|
||
| The enip_command and cip_service keywords can be used for matching on various properties of | ||
| ENIP requests. | ||
| enip_command | ||
| ------------ | ||
|
|
||
| There are three ways of using this keyword: | ||
| For the ENIP command, we are matching against the command field found in the ENIP encapsulation. | ||
|
|
||
| Examples:: | ||
|
|
||
| * matching on ENIP command with the setting "enip_command"; | ||
| * matching on CIP Service with the setting "cip_service". | ||
| * matching both the ENIP command and the CIP Service with "enip_command" and "cip_service" together | ||
| enip_command:99; | ||
| enip_command:ListIdentity; | ||
|
|
||
|
|
||
| For the ENIP command, we are matching against the command field found in the ENIP encapsulation. | ||
| cip_service | ||
| ----------- | ||
|
|
||
| For the CIP Service, we use a maximum of 3 comma separated values representing the Service, Class and Attribute. | ||
| These values are described in the CIP specification. CIP Classes are associated with their Service, and CIP Attributes | ||
| are associated with their Service. If you only need to match up until the Service, then only provide the Service value. | ||
| If you want to match to the CIP Attribute, then you must provide all 3 values. | ||
|
|
||
|
|
||
| Syntax:: | ||
|
|
||
| enip_command:<value> | ||
| cip_service:<value(s)> | ||
| enip_command:<value>, cip_service:<value(s)> | ||
|
|
||
|
|
||
| Examples:: | ||
|
|
||
| enip_command:99 | ||
| cip_service:75 | ||
| cip_service:16,246,6 | ||
| enip_command:111, cip_service:5 | ||
|
|
||
|
|
||
| (cf. http://read.pudn.com/downloads166/ebook/763211/EIP-CIP-V1-1.0.pdf) | ||
|
|
||
| Information on the protocol can be found here: | ||
| `<http://literature.rockwellautomation.com/idc/groups/literature/documents/wp/enet-wp001_-en-p.pdf>`_ | ||
|
|
||
| enip.status | ||
| ----------- | ||
|
|
||
| For the ENIP status, we are matching against the status field found in the ENIP encapsulation. | ||
| It uses a 32-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.status:100; | ||
| enip.status:>106; | ||
|
|
||
| enip.protocol_version | ||
| --------------------- | ||
|
|
||
| Match on the protocol version in identity message. | ||
| It uses a 16-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.protocol_version:1; | ||
| enip.protocol_version:>1; | ||
|
|
||
| enip.revision | ||
| --------------------- | ||
|
|
||
| Match on the revision in identity message. | ||
| It uses a 16-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.revision:1; | ||
| enip.revision:>1; | ||
|
|
||
| enip.identity_status | ||
| -------------------- | ||
|
|
||
| Match on the status in identity message (not in ENIP header). | ||
| It uses a 16-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.identity_status:1; | ||
| enip.identity_status:>1; | ||
|
|
||
| enip.state | ||
| ---------- | ||
|
|
||
| Match on the state in identity message. | ||
| It uses a 8-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.state:1; | ||
| enip.state:>1; | ||
|
|
||
| enip.serial | ||
| ----------- | ||
|
|
||
| Match on the serial in identity message. | ||
| It uses a 32-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.serial:1; | ||
| enip.serial:>1; | ||
|
|
||
| enip.product_code | ||
| ----------------- | ||
|
|
||
| Match on the product code in identity message. | ||
| It uses a 16-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.product_code:1; | ||
| enip.product_code:>1; | ||
|
|
||
| enip.device_type | ||
| ---------------- | ||
|
|
||
| Match on the device type in identity message. | ||
| It uses a 16-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.device_type:1; | ||
| enip.device_type:>1; | ||
|
|
||
| enip.vendor_id | ||
| -------------- | ||
|
|
||
| Match on the vendor id in identity message. | ||
| It uses a 16-bit unsigned integer as value. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.vendor_id:1; | ||
| enip.vendor_id:>1; | ||
|
|
||
| enip.product_name | ||
| ----------------- | ||
|
|
||
| Match on the product name in identity message. | ||
|
|
||
| Examples:: | ||
|
|
||
| enip.product_name; pcre:"/^123[0-9]*/"; | ||
| enip.product_name; content:"swordfish"; | ||
|
|
||
| ``enip.product_name`` is a 'sticky buffer' and can be used as ``fast_pattern``. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # ENIP app layer event rules | ||
| # | ||
| # SID's fall in the 2223000+ range. See https://redmine.openinfosecfoundation.org/projects/suricata/wiki/AppLayer | ||
| # | ||
| # These sigs fire at most once per connection. | ||
| # | ||
| alert enip any any -> any any (msg:"SURICATA ENIP too many transactions"; app-layer-event:enip.too_many_transactions; classtype:protocol-command-decode; sid:2234000; rev:1;) | ||
| alert enip any any -> any any (msg:"SURICATA ENIP invalid PDU"; app-layer-event:enip.invalid_pdu; classtype:protocol-command-decode; sid:2234001; rev:1;) |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it have its own commit despite being just one line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, why so ?
My logic is to put in the commit, the line using it, ie calling
AppLayerParserRegisterParserAcceptableDataDirectionfrom rustThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your logic is undoubtedly sound.
However, considering that you're introducing a new function for the app layer, which can be reused in other protocols, I thought that creating a specific commit would provide a clear history in the git log.
This way, it can be easily traced back to its introduction if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is not new.
It makes it merely accessible to rust app-layers...