Closed Bug 1819172 Opened 2 years ago Closed 2 years ago

Integer Overflow in Expiry Value of SiteSecurityServiceState.txt

Categories

(Core :: Security: PSM, defect, P1)

Firefox 110
defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: bugzilla, Assigned: keeler)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0

Steps to reproduce:

I programmed a web server that returns an HSTS header with max-age calculated like this:

max-age = (2**64 - currentUnixTimestampInMillis - 1000)/1000

I visited the server with Firefox. The following header was transferred:

Strict-Transport-Security max-age=18446742396180544

Actual results:

The SiteSecurityServiceState.txt file now contains a negative expiry date:

$ grep "hsts.local" ~/.mozilla/firefox/iy6semmg.default-release/SiteSecurityServiceState.txt
0000.hsts.local^partitionKey=%28http%2Chsts.local%29:HSTS 0 19415 -1051,1,0

This value is calculated as follows:

  1. Firefox takes the max-age and multiplies it by 1000 to convert it into milliseconds, i.e. 18446742396180544000
  2. Firefox adds the current timestamp in milliseconds to the value. This currently is a value around 1677529277474.
  3. Firefox stores the result (~ 2**64 - 1000) as a signed integer into SiteSecurityServiceState.txt. The two's complement of that value is -1000.

Expected results:

  1. The expiry date should have been stored as an unsigned integer.
  2. Regardless of 1., within the calculation (multiplying by 1000 and adding the current time stamp) it should be checked whether an overflow is going to occur.
Component: Untriaged → Security: PSM
Product: Firefox → Core

The severity field is not set for this bug.
:keeler, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dkeeler)
Assignee: nobody → dkeeler
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: -- → S4
Flags: needinfo?(dkeeler)
Priority: -- → P1
Pushed by dkeeler@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/583cab6067b0 cap max-age from HTTP Strict Transport Security headers at 100 years r=jschanck
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
QA Whiteboard: [qa-113b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: