-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fuzzing updates: all-clusters-app #27858
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d2454e2
Add `CHIP_CONFIG_SECURITY_FUZZ_MODE` to *disable* encryption and sign…
zcduthie 0ae88b3
Add fuzz driver manual injection of test (`sessionId=1`) session
zcduthie 9d7a999
Disable duplicate message check
zcduthie de5734d
Add seed corpus
zcduthie a01dfd1
Turn OFF CHIP_CONFIG_SECURITY_FUZZ_MODE
zcduthie d7b75ca
Restyled by clang-format
restyled-commits 6d99874
Restyled by shfmt
restyled-commits 5d9bf14
Merge branch 'master' into fuzz-clusters
zcduthie 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 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 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 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 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
Binary file added
BIN
+598 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_01QEnWIXzk4c.bin
Binary file not shown.
Binary file added
BIN
+36 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_5f48l5XQql8P.bin
Binary file not shown.
Binary file added
BIN
+26 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_5xmcYggBlU95.bin
Binary file not shown.
Binary file added
BIN
+165 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_6ENeo9RU1NS1.bin
Binary file not shown.
Binary file added
BIN
+63 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_7Wlua0NCK2wS.bin
Binary file not shown.
Binary file added
BIN
+26 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_8EL7Zn6UgwlG.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_8FIjTovt2CDr.bin
Binary file not shown.
Binary file added
BIN
+48 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_Ark3PfsalURO.bin
Binary file not shown.
Binary file added
BIN
+26 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_Ax6NWoyjQAeV.bin
Binary file not shown.
Binary file added
BIN
+23 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_B7etdJoEJEcd.bin
Binary file not shown.
Binary file added
BIN
+598 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_CcCx7dKtqsyG.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_DI68pa50Te4S.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_Dta41uhRiMmb.bin
Binary file not shown.
Binary file added
BIN
+49 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_EkOWmKwOMkiK.bin
Binary file not shown.
Binary file added
BIN
+277 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_FjElLo2eDTjB.bin
Binary file not shown.
Binary file added
BIN
+165 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_G8Mb7QHxXcv5.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_GAeJ9RDFdYMC.bin
Binary file not shown.
Binary file added
BIN
+46 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_IbeBlfR4BB0t.bin
Binary file not shown.
Binary file added
BIN
+78 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_JPQ70mZvvYWz.bin
Binary file not shown.
Binary file added
BIN
+165 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_K63r7Zgba7tz.bin
Binary file not shown.
Binary file added
BIN
+54 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_KWmyk9AytZTf.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_L9qEgJsXgsho.bin
Binary file not shown.
Binary file added
BIN
+26 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_LC67PAVWgGPE.bin
Binary file not shown.
Binary file added
BIN
+26 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_O4uy9lvAmKOZ.bin
Binary file not shown.
Binary file added
BIN
+36 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_OIkLG6oYDrPI.bin
Binary file not shown.
Binary file added
BIN
+43 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_PGJMrcK7kggp.bin
Binary file not shown.
Binary file added
BIN
+26 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_PsQEOanp6pC6.bin
Binary file not shown.
Binary file added
BIN
+598 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_RY2N2Ngduavp.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_SohLvtxfVebJ.bin
Binary file not shown.
Binary file added
BIN
+550 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_YjtE6dnLN16i.bin
Binary file not shown.
Binary file added
BIN
+165 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_a0QQLCHnrWAZ.bin
Binary file not shown.
Binary file added
BIN
+46 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_aDlkmKS4v7De.bin
Binary file not shown.
Binary file added
BIN
+107 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_c4nLz7mnm8cU.bin
Binary file not shown.
Binary file added
BIN
+67 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_eJhjAa8NlxKQ.bin
Binary file not shown.
Binary file added
BIN
+165 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_elEkYOpjDZkc.bin
Binary file not shown.
Binary file added
BIN
+598 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_f5oyMg6DdEVC.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_mcgwofp9odLU.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_mwMapLqs0tzl.bin
Binary file not shown.
Binary file added
BIN
+96 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_nhOrhFaelF5O.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_oFa5RDio560R.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_og4nO8PlQ76f.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_p7L0a4ClLIrA.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_pS7caj4wtA3I.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_rP2C9kWzAbZk.bin
Binary file not shown.
Binary file added
BIN
+18 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_rx8IbDl7wcL0.bin
Binary file not shown.
Binary file added
BIN
+48 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_sFHYW9EPTNZW.bin
Binary file not shown.
Binary file added
BIN
+78 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_uBzb3hPbsALd.bin
Binary file not shown.
Binary file added
BIN
+23 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_vKAA4tdA5ynt.bin
Binary file not shown.
Binary file added
BIN
+598 Bytes
integrations/fuzz/chip-all-clusters-app-fuzzing-corpus/message_xtpIcyW1gJui.bin
Binary file not shown.
This file contains 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 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 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 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 |
---|---|---|
|
@@ -48,6 +48,16 @@ CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView | |
|
||
ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(msgBuf)); | ||
|
||
// Skip encryption and message integrity! | ||
#if CHIP_CONFIG_SECURITY_FUZZ_MODE | ||
#warning \ | ||
"Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 bypassing encryption! Node can only communicate with other nodes built with this flag set. Requires build flag 'treat_warnings_as_errors=false'." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "requires build flag" bit is:
Same for Decrypt. |
||
ChipLogError(SecureChannel, | ||
"Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 bypassing encryption... " | ||
"Node can only communicate with other nodes built with this flag set."); | ||
return CHIP_NO_ERROR; | ||
#endif | ||
|
||
uint8_t * data = msgBuf->Start(); | ||
uint16_t totalLen = msgBuf->TotalLength(); | ||
|
||
|
@@ -68,6 +78,17 @@ CHIP_ERROR Decrypt(const CryptoContext & context, CryptoContext::ConstNonceView | |
{ | ||
ReturnErrorCodeIf(msg.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); | ||
|
||
#if CHIP_CONFIG_SECURITY_FUZZ_MODE | ||
#warning \ | ||
"Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 bypassing decryption! Node can only communicate with other nodes built with this flag set. Requires build flag 'treat_warnings_as_errors=false'." | ||
ChipLogError(SecureChannel, | ||
"Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 bypassing decryption... " | ||
"Node can only communicate with other nodes built with this flag set."); | ||
|
||
ReturnErrorOnFailure(payloadHeader.DecodeAndConsume(msg)); | ||
return CHIP_NO_ERROR; | ||
#endif | ||
|
||
uint8_t * data = msg->Start(); | ||
uint16_t len = msg->DataLength(); | ||
|
||
|
This file contains 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 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 |
---|---|---|
|
@@ -685,8 +685,6 @@ void SessionManager::SecureUnicastMessageDispatch(const PacketHeader & partialPa | |
|
||
CHIP_ERROR err = CHIP_NO_ERROR; | ||
|
||
Optional<SessionHandle> session = mSecureSessions.FindSecureSessionByLocalKey(partialPacketHeader.GetSessionId()); | ||
|
||
PayloadHeader payloadHeader; | ||
|
||
// Drop secure unicast messages with privacy enabled. | ||
|
@@ -699,14 +697,27 @@ void SessionManager::SecureUnicastMessageDispatch(const PacketHeader & partialPa | |
PacketHeader packetHeader; | ||
ReturnOnFailure(packetHeader.DecodeAndConsume(msg)); | ||
|
||
SessionMessageDelegate::DuplicateMessage isDuplicate = SessionMessageDelegate::DuplicateMessage::No; | ||
|
||
if (msg.IsNull()) | ||
{ | ||
ChipLogError(Inet, "Secure transport received Unicast NULL packet, discarding"); | ||
return; | ||
} | ||
|
||
SessionMessageDelegate::DuplicateMessage isDuplicate = SessionMessageDelegate::DuplicateMessage::No; | ||
|
||
Optional<SessionHandle> session = mSecureSessions.FindSecureSessionByLocalKey(partialPacketHeader.GetSessionId()); | ||
|
||
#if CHIP_CONFIG_SECURITY_FUZZ_MODE | ||
// If no valid existing session was found - try to use test session instead. | ||
if (!session.HasValue()) | ||
{ | ||
#warning "Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 using default session!" | ||
ChipLogError(SecureChannel, "Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 using default session... "); | ||
uint16_t kLocalSessionId = 1; | ||
session = mSecureSessions.FindSecureSessionByLocalKey(kLocalSessionId); | ||
} | ||
#endif | ||
|
||
if (!session.HasValue()) | ||
{ | ||
ChipLogError(Inet, "Data received on an unknown session (LSID=%d). Dropping it!", packetHeader.GetSessionId()); | ||
|
@@ -749,8 +760,15 @@ void SessionManager::SecureUnicastMessageDispatch(const PacketHeader & partialPa | |
"Received a duplicate message with MessageCounter:" ChipLogFormatMessageCounter | ||
" on exchange " ChipLogFormatExchangeId, | ||
packetHeader.GetMessageCounter(), ChipLogValueExchangeIdFromReceivedHeader(payloadHeader)); | ||
|
||
#if CHIP_CONFIG_SECURITY_FUZZ_MODE | ||
#warning "Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 bypassing duplicate message check!" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could use some documentation explaining why we would want to do that. |
||
ChipLogError(SecureChannel, "Warning: CHIP_CONFIG_SECURITY_FUZZ_MODE=1 bypassing duplicate message check... "); | ||
#else | ||
isDuplicate = SessionMessageDelegate::DuplicateMessage::Yes; | ||
err = CHIP_NO_ERROR; | ||
#endif | ||
|
||
err = CHIP_NO_ERROR; | ||
} | ||
if (err != CHIP_NO_ERROR) | ||
{ | ||
|
This file contains 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
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.
Shouldn't this be the default value, though? And if so, why are we adding it to all the project configs?