nvx/apertureAll write-ups
No. 09ENGINEERING · 2 min

An assignment due in 2046 crashed the app

An assessment due in July 2046 crashed the Grades screen of the Monash Study App, and a second screen showed the same date as 1910 without a word. The app won't let you enter a date that far ahead, so I had to prove the crash some other way.

By Cyber security, Monash University

One assessment in the Monash Study App was due at 11:55 pm on 21 July 2046. The payload carried that as 2,415,794,100 seconds since 1970, and the Grades screen crashed trying to read it.

The ticket for the crash already had a diagnosis, a decimal where the parser wanted a whole number, and a fix to match. The payload held a whole number, 268,310,453 seconds more than a signed 32-bit Int can hold.

When the assessment was due
2046
Where a signed 32-bit Int runs out
2038
What a second screen showed instead
1910

The 32-bit limit

Where the due date sits
  1. 1Any date in 20301,893,456,000 secondsFits, so it can't show the bug
  2. 219 Jan 20382,147,483,647 seconds2,147,483,647, the last second an Int holds
  3. 321 Jul 20462,415,794,100 seconds2,415,794,100, the due date
  4. Fits in an Int1,577,836,800 seconds to 2,147,483,647 seconds
  5. Too big for an Int2,147,483,648 seconds to 2,524,608,000 seconds
Seconds since 1 January 1970, UTC. Everything before 19 January 2038 fits in a signed 32-bit Int.

What each screen did with it

Two screens reading the same number
GradesTimetable
How it read the numberAs an Int fieldThrough a helper that called toInt()
What happenedGson refused it, and the whole response failedtoInt() kept the low 32 bits and threw nothing
What a student sawA crashA date in 1910
ReportedYes, it had a ticketNo error and no report
The arithmetic, not the app's code
1val seconds = 2_415_794_100L    // 21 Jul 2046, 11:55 pm in Melbourne
2val narrowed = seconds.toInt()  // -1_879_173_196
3// as a date: 15 Jun 1910
  1. 1L2Keeps the low 32 bits, which is 2,415,794,100 minus 2^32. No exception.

I widened the Grades field to Long and split the helper into a Long one for timestamps and an Int one for small counts. That part is in my placement post. The harder part was getting anyone else to see the crash.

A crash nobody could cause

The reviewer couldn't reproduce it in dev, and wanted exact steps before approving, proof the crash existed and then proof the change ended it. I couldn't reproduce it through the app either. It won't let you set a date that far ahead.

I had seeded my own data with a date past 2038 instead, so the reply was a write-up.

What went to the reviewer
PartWhat it said
The fieldThe assessment's due date, in seconds since 1970
The value2,415,794,100, or 21 July 2046
Why 2027 or 2030 won't show itBoth fit in an Int. Nothing before 19 January 2038 overflows
The proofA unit test at the 32-bit edge, already pushed

The reviewer tested it and approved it the same afternoon.

No comments yet

Comments are read before they appear.