Timezone Fingerprinting

Background

Timezone fingerprinting is one of the oldest device prints in existence, and based on my research, incorrectly implemented over and over again. Remember, that a data point is most effective when it does not change over time. Timezone however, in some regions, changes twice a year due to daylight savings time. However, if you thing through the problem not only can this be an effective print, but you can glean additional information about the device.


How It Works

In the code below, we avoid the common pitfall of simply looking at the time zone of the current date, which leads to issues during DST. Instead we select a date during daylight savings, and after, in this case Jan 1st and June 1st. This provides two benefits. First the print remains fixed, second you can tell if the computer is set to automatically adjust for daylight savings time. The latter is often missed by malicious actors and can be an important data point.


Entropy Estimate: 4.4 bits 


Code

The JavaScript function below fingerprints the timezone settings for the device.  
Note: Depending on your output method you may need to URL encode the returned results. 

Source Code

function fp_timezone() {

    "use strict";

    var strOnError, dtDate1, dtDate2, strOffset1, strOffset2, strOut;

 

    strOnError = "<timezone>Error</timezone>";

    dtDate1 = null;

    dtDate2 = null;

    strOffset1 = "";

    strOffset2 = "";

    strOut = "";

 

    try {

        dtDate1 = new Date(2018, 0, 1);

        dtDate2 = new Date(2018, 6, 1);

        strOffset1 = dtDate1.getTimezoneOffset();

        strOffset2 = dtDate2.getTimezoneOffset();

        strOut = "<timezone>" + strOffset1 + "|" + strOffset2 + "</timezone>";

        return strOut;

    } catch (err) {

        return strOnError;

    }

}

Validation

Unlike other code on the Internet we do everything possible to verify our code for you. In order to minimize problems and maximize compatibility this code has been verified with JSLint and has been extensively tested with over 1100 OS/Browser combinations using BrowserStack.


Reference

JavaScript getTimezoneOffset() Method - W3Schools. Retrieved March 01, 2018, from https://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp