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

Duplicate requests not handled during OSCORE context rederivation #2294

Open
burrrrrr opened this issue Oct 13, 2024 · 7 comments
Open

Duplicate requests not handled during OSCORE context rederivation #2294

burrrrrr opened this issue Oct 13, 2024 · 7 comments
Labels
oscore question about oscore

Comments

@burrrrrr
Copy link

burrrrrr commented Oct 13, 2024

With the plugtest server app, during OSCORE context rederivation (Appendix B.2), the server doesn't appear to handle duplicate requests from the client (same token and MID). This is an issue in low availability areas where context rederivation will need to be restarted if a response is lost. If I'm not wrong, it is expected the server can handle multiple context rederivations from replayed requests in parallel.

@burrrrrr burrrrrr changed the title Duplicate packets not handled during OSCORE context rederivation Duplicate requests not handled during OSCORE context rederivation Oct 13, 2024
@boaks boaks added the oscore question about oscore label Oct 14, 2024
@boaks
Copy link
Contributor

boaks commented Oct 14, 2024

I'm not common with OSCORE.

Duplicate requests (same peer, same MID within EXCHANGE_LIFETIME) are handled according RFC 7252 4.5 Message Deduplication. With that I don't see, that there is something special to do.

@rikard-sics

Does OSCORE change that RFC 7252 4.5?

@boaks
Copy link
Contributor

boaks commented Oct 14, 2024

I got aware, that the OSCoreUdpStack puts the ObjectSecurityLayer below the ReliabilityLayer, which then prevents that from deduplicating requests in ReliabilityLayer.receiveRequest.
Not sure, what is the intended behavior or best to fix that.
It may be possible, to change the order of the layer.
Or to add a if (request.isDuplicate()) check to the ObjectSecurityLayer.receiveRequest.

@boaks
Copy link
Contributor

boaks commented Oct 14, 2024

I very first test showed, that exchanging the layers may work.

new BlockwiseLayer(tag, false, config, matchingStrategy),
new ObjectSecurityLayer(ctxDb),
CongestionControlLayer.newImplementation(tag, config)};

@burrrrrr

would it be possible for you to test with that approach until we get a feedback from Rikard?

@rikard-sics
Copy link
Contributor

would it be possible for you to test with that approach until we get a feedback from Rikard?

Yes my spontaneous comment without checking deeper is that swapping the orders of the layers makes sense

@burrrrrr
Copy link
Author

burrrrrr commented Oct 15, 2024

I very first test showed, that exchanging the layers may work.

new BlockwiseLayer(tag, false, config, matchingStrategy),
new ObjectSecurityLayer(ctxDb),
CongestionControlLayer.newImplementation(tag, config)};

@burrrrrr

would it be possible for you to test with that approach until we get a feedback from Rikard?

@rikard-sics @boaks

Great, that fixes the retransmission issue for me.

However, there is another issue in the context rederivation where the server can only handle one ongoing rederivation per sender id. This potentially may be a problem if an attacker initiates context rederivation simultaneously with a different kid context.

On line 285 of ContextRederivation, the context is only retrieved by recipient id.

		// Try to retrieve the context based on the RID only if no context was
		// found. Since the ID Context in the initial request will be a new one
		// and not match existing contexts.
		if (ctx == null) {
			ctx = db.getContext(rid);
		}

I guess this should change to query by rid and context id, which means all ongoing context rederivations need to be tracked. I could give it try. Thoughts?

@rikard-sics
Copy link
Contributor

I guess this should change to query by rid and context id, which means all ongoing context rederivations need to be tracked. I could give it try. Thoughts?

Let me have a look at this and the initial issue you reported. Unfortunately I am quite busy with meetings today but tomorrow I should have some time to put on this.

boaks added a commit to boaks/californium that referenced this issue Oct 18, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 18, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 21, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
@rikard-sics
Copy link
Contributor

However, there is another issue in the context rederivation where the server can only handle one ongoing rederivation per sender id. This potentially may be a problem if an attacker initiates context rederivation simultaneously with a different kid context.

I had a look at the PR for swapping the layers (#2296 ) and that looks good to me. When that is merged I will next take a look at this issue with multiple simultaneous executions of OSCORE context rederivation.

boaks added a commit to boaks/californium that referenced this issue Oct 23, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 24, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 25, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 28, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 28, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 28, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 29, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 30, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
boaks added a commit to boaks/californium that referenced this issue Oct 30, 2024
Swap OSCORE and CongestionControl layers.
Add logback configuration for unittests.

Issue eclipse-californium#2294

Signed-off-by: Achim Kraus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oscore question about oscore
Projects
None yet
Development

No branches or pull requests

3 participants