Skip to content
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

[Clarification/For Discussion] What does 5.5.1 control prevent? #775

Closed
csfreak92 opened this issue May 21, 2020 · 31 comments
Closed

[Clarification/For Discussion] What does 5.5.1 control prevent? #775

csfreak92 opened this issue May 21, 2020 · 31 comments
Assignees
Labels
2) Awaiting response Awaiting a response from the original poster
Milestone

Comments

@csfreak92
Copy link
Collaborator

ASVS 4.0 - 5.5.1 verification requirement is:

Verify that serialized objects use integrity checks or are encrypted to prevent hostile object creation or data tampering.

Is this control talking about link level encryption or object/payload level encryption? Is it protecting the application from a man-in the browser attack (link level encryption) or preventing a user from modifying his data (object/payload level encryption)? If those are the case, then I think clarifying the main point of this control would help developers know what to do to protect their application from such attacks and I would propose a clearer language in a pull request like:

Verify that serialized objects use integrity checks (object/payload level encryption) or are encrypted (link level encryption) to prevent hostile object creation or data tampering.

@tghosth
Copy link
Collaborator

tghosth commented May 21, 2020

My understand of this control is that it is specifically refering to the serialized object. Either an integrity check (like a hash or signature) or encryption should be used to ensure it has not been tampered with.

Not sure how else to clarify that. Any thoughts?

@tghosth tghosth self-assigned this May 21, 2020
@tghosth tghosth added the 2) Awaiting response Awaiting a response from the original poster label May 21, 2020
@csfreak92 csfreak92 changed the title [Clarification/For Discussion] What does "untrusted" mean in 5.5.1 [Clarification/For Discussion] What does 5.5.1 control prevent? May 21, 2020
@csfreak92
Copy link
Collaborator Author

Aren't hashes or signatures of input values coming from the client-side prone to tampering as well? If a serialized object (with constant values) are being round-tripped from the server to the client and back to the server, then hashes or signatures could work. But if the input is fresh from the client and to the server, then those won't work. Am I missing something?

Encryption would be the best, although I think link level encryption could suffice for most applications, object level encryption would be a better recommendation for applications with higher risks. Should we mention this somewhere in the controls in ASVS?

@jmanico
Copy link
Member

jmanico commented May 21, 2020 via email

@tghosth tghosth assigned jmanico and unassigned tghosth May 21, 2020
@csfreak92
Copy link
Collaborator Author

Sorry, let me rephrase what I meant by my previous comment. I might have been confusing.

Aren't hashes or signatures of input values coming from the client-side prone to tampering as well? If a serialized object (with constant values) are being round-tripped from the server to the client and back to the server, then hashes or signatures could work. But if the input is fresh from the client and to the server, then those won't work. Am I missing something?

What I meant here was if we will generate signatures or hashes from the client-side every time new input is received, then that is prone to tampering and it could be circumvented. If the hashes or signatures are generated on client-side which would be a horrible implementation of it. However, if hashes or signatures are done on the server-side and the values are being passed around then it helps. But what about new inputs? I think that's the problematic part in serialization, receiving input that could end up causing deserialization issues, no?

Encryption would be the best, although I think link level encryption could suffice for most applications, object level encryption would be a better recommendation for applications with higher risks. Should we mention this somewhere in the controls in ASVS?

What I meant here was if we have link level encryption (communications encryption) then it could help but still be bypassed and I totally agree with you on that, so object/payload level encryption would be best.

@jmanico, isn't encryption on a payload level providing tamper resistance?

@jmanico
Copy link
Member

jmanico commented Jun 2, 2020 via email

@elarlang
Copy link
Collaborator

@csfreak92 - for "new input" there is another requirement:

V5.5.3 Verify that deserialization of untrusted data is avoided or is protected in both custom code and third-party libraries (such as JSON, XML and YAML parsers).

But V5.5.1 is not clear for me also. Isn't it duplicate for V5.5.3 " or is protected in both custom code and third-party libraries (such as JSON, XML and YAML parsers)"? What is this protection?

Does it makes it more clear?

V5.5.1 Verify that serialized objects use integrity checks on/for/at unserialize or are encrypted to prevent hostile object creation or data tampering.

To validate requirements - where to use "PHP Object Injection" - input is generated by applcation, sent to user, and userinput goes back directly to unserialize function.

From V5.5.1 point of view - integrity check is missing.
From V5.5.3 point of view - an applcation should not take user input to unserialize function at all.

My question/point, do V5.5.1 and V5.5.3 actually address the same problem and should me merged?

@jmanico
Copy link
Member

jmanico commented Jun 10, 2020 via email

@elarlang
Copy link
Collaborator

For "up to date" there is requirement:

V14.2.1 Verify that all components are up to date, preferably using a dependency checker during build or compile time.

Personally I don't see/feel relation between up-to-date requirement and current V5.3.3

@jmanico
Copy link
Member

jmanico commented Jun 10, 2020 via email

@elarlang
Copy link
Collaborator

V5.5.3 Verify that deserialization of untrusted data is avoided or is protected in both custom code and third-party libraries (such as JSON, XML and YAML parsers).

V14.2.1 Verify that all components are up to date, preferably using a dependency checker during build or compile time.

From:

V5.5.3 Verify that deserialization of untrusted data is avoided or is protected in both custom code and third-party libraries (such as JSON, XML and YAML parsers).

I interpret it as:

V5.5.3 Verify that deserialization of untrusted data is protected in third-party libraries (such as JSON, XML and YAML parsers).

"data is protected by third party libraries" vs "third party libraries are up to date" - if they are the same thing, then it makes sense to remove second part of V5.3.3 and merge first part of V5.3.3 with V5.3.1.

@jmanico
Copy link
Member

jmanico commented Jun 10, 2020 via email

@elarlang
Copy link
Collaborator

I made separate issue for removing V5.5.3.

Back to V5.5.1 - if V5.5.3 will be removed, V5.5.1 should also cover "left-overs" from V5.5.3.

Current:

V5.5.1 Verify that serialized objects use integrity checks or are encrypted to prevent hostile object creation or data tampering.

It should cover now also:

  • "deserialization of untrusted data is avoided"

with my estonglish (estonian version of english) I don't even try to propose anything...

@jmanico
Copy link
Member

jmanico commented Jun 10, 2020 via email

@elarlang
Copy link
Collaborator

If you send (for some reason) serialized data from one service to another (or back to the same service), it makes sense for me to use hmac - if it does not match, no action.

@jmanico
Copy link
Member

jmanico commented Jun 10, 2020 via email

@elarlang
Copy link
Collaborator

If you send (for some reason) serialized data from one service to another (or back to the same service), it makes sense for me to use hmac - if it does not match, no action.

hmac here is only for integrity check, I don't touch confidentiality here.

@jmanico
Copy link
Member

jmanico commented Jun 11, 2020 via email

@elarlang
Copy link
Collaborator

Any changes to the current requirement V5.5.1 for ASVS v4.0.2 or you want to re-create entire topic for ASVS v4.1 and issue #807 ?

@jmanico
Copy link
Member

jmanico commented Jun 11, 2020 via email

@csfreak92
Copy link
Collaborator Author

@elarlang, I agree with @jmanico with this. I think 5.1.1 is too problematic as a requirement. It seems that 5.1.3 covers deserialization issues anyway and having 5.1.1 just confuses a tester/developer. I believe our discussion about this was helpful in determining whether integrity checks really help in preventing hostile object tampering or creation. I vote to remove 5.1.1 as well unless there's something else we are missing to cover for integrity checks.

@elarlang
Copy link
Collaborator

So, to conclude and be clear:
remove current V5.5.1 from ASVS v4.1 (and no changes to ASVS v4.0.2)?

@jmanico
Copy link
Member

jmanico commented Jun 11, 2020 via email

@elarlang
Copy link
Collaborator

I understood that we will not have any removals for v4.0.2 (if not clear duplicate).

#750 (comment)

@jmanico
Copy link
Member

jmanico commented Jun 11, 2020 via email

@tghosth
Copy link
Collaborator

tghosth commented Jun 12, 2020

Thanks @elarlang, I agree that this sounds too major a change for 4.0.2 but should be changed for 4.1.

@tghosth
Copy link
Collaborator

tghosth commented Jun 12, 2020

To quote @vanderaj:

Branch 4.0.2 - bug fixes only. Will require some work to back port the
fixes from master. The only thing I would countenance here is duplicate
issue removal, spelling fixes, and clarifications.

@vanderaj
Copy link
Member

I will review this issue carefully for 4.0.2, re-wording is okay, but additions, substantial changes of meaning, etc. need to be 4.1.

@jmanico
Copy link
Member

jmanico commented Jul 13, 2020

Can we just drop 5.5.1 from 4.0.2? It's off base.

jmanico added a commit that referenced this issue Jul 13, 2020
@jmanico
Copy link
Member

jmanico commented Jul 13, 2020

requirement removed per 1180694

@jmanico jmanico closed this as completed Jul 13, 2020
@elarlang
Copy link
Collaborator

elarlang commented Jan 1, 2023

Reopen the issue for:

  • @tghosth rechecking related issues and changes
  • posting my label validation / mapping between versions just in case we need to revisit it

v4.0.3

Related requirements:

# Description L1 L2 L3 CWE
1.5.2 Verify that serialization is not used when communicating with untrusted clients. If this is not possible, ensure that adequate integrity controls (and possibly encryption if sensitive data is sent) are enforced to prevent deserialization attacks including object injection. 502
5.5.1 Verify that serialized objects use integrity checks or are encrypted to prevent hostile object creation or data tampering. (C5) 502
5.5.3 Verify that deserialization of untrusted data is avoided or is protected in both custom code and third-party libraries (such as JSON, XML and YAML parsers). 502

Related issues:

v5.0 as it stands

# Description L1 L2 L3 CWE
1.5.2 [DELETED, MERGED TO 5.5.3]
5.5.1 [DELETED]
5.5.3 [MODIFIED, MERGED FROM 1.5.2] Verify that deserialization is not used when communicating with untrusted clients. If this is not possible, ensure that deserialization is performed safely, for example, by only allowing a allow-list of object types or not allowing the client to define the object type to deserialize to, in order to prevent deserialization attacks. 502

I try to get rid of just "DELETED" labels and the question is - the most suitable reason for 5.5.1 seems to be DELETED, INCORRECT. No need to reference to any requirement, like 5.5.3. In case we need, then it should be MERGED TO 5.5.3 (which is not valid) or DEPRECATED BY 5.5.3

@elarlang elarlang reopened this Jan 1, 2023
@tghosth
Copy link
Collaborator

tghosth commented Jan 3, 2023

I would support DELETED, INCORRECT

elarlang pushed a commit to elarlang/ASVS that referenced this issue Jan 3, 2023
@tghosth tghosth closed this as completed in f11971d Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2) Awaiting response Awaiting a response from the original poster
Projects
None yet
Development

No branches or pull requests

5 participants