Skip to content

Conversation

@sydseter
Copy link
Collaborator

@sydseter sydseter commented Jul 15, 2025

This PR is related to OWASP/mastg#2588
but does not close it.

Description

See issue for details.


[x] I have read the contributing guidelines.

Guidelines for Pull Requests (you can delete this section after reading):

  • Please ensure that your content follows the style guide.
  • If you are working on Porting MASTG v1 Tests to v2, refer to this document.
  • If you are working on new MASWE, tests, or demos, refer to this document.

@sydseter sydseter changed the title Fixes https://github.com/OWASP/mastg/issues/2588 Fixes OWASP/mastg#2588 [MASWE-0024] Weak Message Authentication Codes (MAC) Jul 15, 2025
@sydseter sydseter changed the title Fixes OWASP/mastg#2588 [MASWE-0024] Weak Message Authentication Codes (MAC) Related to OWASP/mastg#2588 [MASWE-0024] Weak Message Authentication Codes (MAC) Jul 17, 2025
@sydseter sydseter changed the title Related to OWASP/mastg#2588 [MASWE-0024] Weak Message Authentication Codes (MAC) Adds to OWASP/mastg#2588 [MASWE-0024] Weak Message Authentication Codes (MAC) Jul 17, 2025
@cpholguera cpholguera requested a review from Diolor October 29, 2025 09:27
Comment on lines 44 to 45
- **Loss of Integrity and authenticity**: Improper use of MAC may result in replay attacks or, in worse case, broken authentication that could compromise the integrity of a system.
- **Loss of Confidentiality**: Using MAC for other purposes than authentication may lead to a complete loss of confidentiality.
Copy link
Collaborator

Choose a reason for hiding this comment

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

MACs aim for data authenticity while HMAC for integrity and authenticity.
As a basis I think we should focus give a clear separation and understanding of those 2 to the reader.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Divided it in three.


Improper use of a MAC by e.g., generating a MAC over a message without the timestamp can make the application susceptible for replay attacks.

Another common issue is using an HMAC with any type of general based hashing algorithm like MD5, SHA-1, SHA-2 or even SHA-3 on low-entropy input like user supplied passwords and pins. HMAC aren't designed for low-entropy inputs or low-entropy keys. Doing so will result in producing "weak" message digests that easily can be exploited.
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe instead of repeating insecure hashes we could point to the hash-related weakness you have written

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's kind of interrelated and I am not really emphasizing the weakness in the underlying algorithm here. I am trying to point to the issue with using low-entropy inputs.


Another common issue is using an HMAC with any type of general based hashing algorithm like MD5, SHA-1, SHA-2 or even SHA-3 on low-entropy input like user supplied passwords and pins. HMAC aren't designed for low-entropy inputs or low-entropy keys. Doing so will result in producing "weak" message digests that easily can be exploited.

A deprecated HMAC implementation may contain bugs that could compromise the authenticity of the data.
Copy link
Collaborator

Choose a reason for hiding this comment

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

that's an impact. Also "contain bugs" is a tad too generic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, but isn't this the overview?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed this section. New read-through necessary.

- **Loss of Integrity and authenticity**: Improper use of MAC may result in replay attacks or, in worse case, broken authentication that could compromise the integrity of a system.
- **Loss of Confidentiality**: Using MAC for other purposes than authentication may lead to a complete loss of confidentiality.

## Modes of Introduction
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's also structure this section into MAC and HMAC and their respective "issues".

Also the draft section in header, has more inspiration, like insecure hash function for HMAC (we can link to related WE)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added all the cases mentioned in the header now.

Clarified the overview and impact of improper MAC usage, emphasizing the risks of MAC forgeries and the need for proper sequence numbers or timestamps. Updated details on the consequences of using HMAC with low-entropy inputs and the importance of avoiding deprecated implementations.
Updated the overview and mitigations sections to clarify issues with MAC usage, including nonce and timestamp importance, and deprecated HMAC implementations. Removed redundant information and improved clarity.
@sydseter sydseter requested a review from Diolor November 3, 2025 11:49
@cpholguera cpholguera requested a review from Copilot November 15, 2025 12:53
Copilot finished reviewing on behalf of cpholguera November 15, 2025 12:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive documentation content for MASWE-0024 (Weak Message Authentication Codes) as part of the OWASP MASTG project. The addition transforms the weakness entry from a placeholder into a complete documentation page.

Key Changes:

  • Added detailed Overview section explaining common MAC implementation weaknesses including improper nonce/timestamp usage, incorrect MAC application order with CBC mode, and issues with deprecated algorithms
  • Added Impact section describing consequences including loss of authenticity, integrity, and confidentiality
  • Added Modes of Introduction and Mitigations sections providing practical guidance for developers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants