Y2K22 — The Mistake That Embarrasses Us

TL;DR: We need to follow one simple rule. Follow the bijection.

The new year arrived with new errors on Microsoft Exchange.

It causes millions of emails worldwide to go undeliverable.

Many of them remain stuck in email transport queues.

Some queues are full and cause entire servers to crash.

The problem

Y2K22 is familiar to engineers like me who worked in Y2K Bug.

Someone abused an incorrect date representation by using something that is not a date.

Exchange’s malware scanning engine stores signature dates using 32-bit integers.

Using integers to store dates is a clear bijection violation.

Also a primitive obsession and premature optimization code smell.

The Chain of Responsibilities

Some developer decided (probably without a real benchmark) that storing dates as 32-bit integers was a smart move.

However, The largest possible number that can be stored in 32-bit is 2147483647.

Things were fine for the 2021 dates because it was stamped as 211231XXXX (for 31st December) using YYMMDDhhmm format.

Yet another smell, Date and time are continuous and consecutive measures.

So are integers, but not this absurd representation.

But the developer was not alone.

The peer reviewer stated that it was a very good optimization.

Also, the QA team forgot to make basic boundaries testing using the Zombies technique.

The error

Happy new year.

It is January 1st, 2022, according to this bijection we need to convert it to 2201010001.

This is not possible when trying to format it to 32-bits.

The outcome is larger than the maximum number allowed.

This would cause timestamp validations on the server software to fail.

As a result, lots of emails are not being sent piling up on servers.

The fix

Fixing this problem. (It is not a bug) is very difficult.

Exchange is a product running on on-premises servers so it has to be patched manually in many cases.

The manual fix you can execute on your Powershell console is easy.

Set the date on the signature file as 2112330001 (December 33rd, 2021)

Yes. it is no joke.

That is the patch.

Violate and abuse the bijection again creating representations of not real entities.

Using this exploit to set this invalid date should also raise an error according to fail fast principle.

Conclusions

If you want to develop serious software and be proud of it, just be loyal to the bijection.

If you create accurate models of your problems your software will always work as expected.

--

--

--

I’m a senior software engineer specialized in declarative designs. S.O.L.I.D. and agile methodologies fan. Maximilianocontieri.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to configure Feign client retry mechanism ?

Tuesday update from PointPay

Meet European Data Security and Privacy Compliance with Big Data Analytics in Public Cloud…

IoT Server Virtualization

Linked Lists

Python Course

What are the Pros and Cons of Using Python for Machine Learning?

Syntax adventures in 43 languages

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Maximiliano Contieri

Maximiliano Contieri

I’m a senior software engineer specialized in declarative designs. S.O.L.I.D. and agile methodologies fan. Maximilianocontieri.com

More from Medium

Four horsemen of a software project apocalypse.

Code Smell 105 — Comedian Methods

A programmer’s story : Escaping the “bubble” of Imperative programming

Understand Functional vs. Procedural Programming by Making a Sandwich.