Do I need to mitigate possible timing attacks when querying DynamoDB?

1

I'm storing user session tokens as strings in a DynamoDB table. When my users make requests to my API, I query my sessions table with the session token provided by the user to check that it is a real session token and find the user that it corresponds to. The session token is in the partition key of the table and the query is simply searching the partition key for string equality with the user-provided token. If there's no match then I immediately return an error code to the API request.

I'm wondering whether a timing attack is possible here. Specifically, I'm wondering whether the time taken for non-matching DynamoDB queries would vary in a measurable way if the queried value was a partial match for an entry in the table? Presumably that would allow an attacker to find a valid session key one character at a time.

Or alternatively, is the time taken for a partition key string equality query constant whether or not it's a partial match?

If this is a concern, is there a conventional way for mitigating it? The first idea that comes to mind would be to measure the time taken for the API request and if the query fails simply wait until a constant amount of time has passed before returning the error so that no timing information is revealed to the attacker. Would that be suitable?

JJC1138
질문됨 2년 전268회 조회
1개 답변
2
수락된 답변

It's not a concern. The partition key is hashed before being used to look for the item from the underlying physical partition. Two slightly different partition key values will hash very differently.

AWS
답변함 2년 전
profile pictureAWS
전문가
검토됨 2년 전
  • That's great to know. Thank you very much!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠