Common stuff for all my devices' web server pages: css, login, log, ipv4, ipv6, firmware update, clock, reset info etc.

Dependents:   oldheating gps motorhome heating

Security

A password has to be set whenever there has been a software reset. Resets following faults or power on do not require a new password as the hash is restored from the RTC GPREG register.

The password is not saved on the device; instead a 32 bit hash of the password is saved. It would take 2^31 attempts to brute force the password: this could be done in under a month if an attempt were possible every millisecond. To prevent this a 200 ms delay is introduced in the reply to the login form, that gives a more reasonable 13 years to brute force the password.

Once the password is accepted a random session id is created. This is 36 bit to give six base 64 characters but without an extra delay. If an attempt could be made every ms then this would still take over a year to brute force.

The most likely attack would to use a dictionary with, say, 10 million entries against the password which would still take 20 days to do.

Committer:
andrewboyson
Date:
Wed Jul 31 15:09:15 2019 +0000
Revision:
127:bd6dd135009d
Parent:
110:8ab752842d25
Child:
152:edbf676b08ca
Amalgamated Reply into Poll function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 97:d9a821ab0f3d 1 //Net trace script
andrewboyson 14:c3c43c8faf0e 2 'use strict';
andrewboyson 97:d9a821ab0f3d 3 function setDirection(elem, iChar, iBit)
andrewboyson 14:c3c43c8faf0e 4 {
andrewboyson 97:d9a821ab0f3d 5 elem.setAttribute('dir', Ajax.hexToBit(Ajax.response.charAt(iChar), iBit) ? 'rtl' : 'ltr');
andrewboyson 14:c3c43c8faf0e 6 }
andrewboyson 14:c3c43c8faf0e 7 function display()
andrewboyson 14:c3c43c8faf0e 8 {
andrewboyson 14:c3c43c8faf0e 9 var elem;
andrewboyson 97:d9a821ab0f3d 10 elem = Ajax.getElementOrNull('ajax-trace-dns-ip4' ); if (elem) setDirection(elem, 0, 1);
andrewboyson 97:d9a821ab0f3d 11 elem = Ajax.getElementOrNull('ajax-trace-ntp-ip4' ); if (elem) setDirection(elem, 0, 2);
andrewboyson 97:d9a821ab0f3d 12 elem = Ajax.getElementOrNull('ajax-trace-tftp-ip4' ); if (elem) setDirection(elem, 0, 3);
andrewboyson 97:d9a821ab0f3d 13 elem = Ajax.getElementOrNull('ajax-trace-net-host' ); if (elem) elem.value = Ajax.response.substr( 1, 4);
andrewboyson 97:d9a821ab0f3d 14 elem = Ajax.getElementOrNull('ajax-trace-net-stack' ); if (elem) setDirection(elem, 5, 0);
andrewboyson 97:d9a821ab0f3d 15 elem = Ajax.getElementOrNull('ajax-trace-net-newline' ); if (elem) setDirection(elem, 5, 1);
andrewboyson 97:d9a821ab0f3d 16 elem = Ajax.getElementOrNull('ajax-trace-net-verbose' ); if (elem) setDirection(elem, 5, 2);
andrewboyson 97:d9a821ab0f3d 17 elem = Ajax.getElementOrNull('ajax-trace-link' ); if (elem) setDirection(elem, 5, 3);
andrewboyson 97:d9a821ab0f3d 18 elem = Ajax.getElementOrNull('ajax-trace-dns-name' ); if (elem) setDirection(elem, 6, 0);
andrewboyson 97:d9a821ab0f3d 19 elem = Ajax.getElementOrNull('ajax-trace-dns-query' ); if (elem) setDirection(elem, 6, 1);
andrewboyson 97:d9a821ab0f3d 20 elem = Ajax.getElementOrNull('ajax-trace-dns-reply' ); if (elem) setDirection(elem, 6, 2);
andrewboyson 97:d9a821ab0f3d 21 elem = Ajax.getElementOrNull('ajax-trace-dns-server' ); if (elem) setDirection(elem, 6, 3);
andrewboyson 97:d9a821ab0f3d 22 elem = Ajax.getElementOrNull('ajax-trace-ntp' ); if (elem) setDirection(elem, 7, 0);
andrewboyson 97:d9a821ab0f3d 23 elem = Ajax.getElementOrNull('ajax-trace-dhcp' ); if (elem) setDirection(elem, 7, 1);
andrewboyson 97:d9a821ab0f3d 24 elem = Ajax.getElementOrNull('ajax-trace-ns-recv-sol' ); if (elem) setDirection(elem, 7, 2);
andrewboyson 97:d9a821ab0f3d 25 elem = Ajax.getElementOrNull('ajax-trace-ns-recv-adv' ); if (elem) setDirection(elem, 7, 3);
andrewboyson 97:d9a821ab0f3d 26 elem = Ajax.getElementOrNull('ajax-trace-ns-send-sol' ); if (elem) setDirection(elem, 8, 0);
andrewboyson 97:d9a821ab0f3d 27 elem = Ajax.getElementOrNull('ajax-trace-nr4' ); if (elem) setDirection(elem, 8, 1);
andrewboyson 97:d9a821ab0f3d 28 elem = Ajax.getElementOrNull('ajax-trace-nr6' ); if (elem) setDirection(elem, 8, 2);
andrewboyson 97:d9a821ab0f3d 29 elem = Ajax.getElementOrNull('ajax-trace-ntp-client' ); if (elem) setDirection(elem, 8, 3);
andrewboyson 97:d9a821ab0f3d 30 elem = Ajax.getElementOrNull('ajax-trace-echo4' ); if (elem) setDirection(elem, 9, 2);
andrewboyson 97:d9a821ab0f3d 31 elem = Ajax.getElementOrNull('ajax-trace-echo6' ); if (elem) setDirection(elem, 9, 3);
andrewboyson 97:d9a821ab0f3d 32 elem = Ajax.getElementOrNull('ajax-trace-dest6' ); if (elem) setDirection(elem, 10, 0);
andrewboyson 97:d9a821ab0f3d 33 elem = Ajax.getElementOrNull('ajax-trace-ra' ); if (elem) setDirection(elem, 10, 1);
andrewboyson 97:d9a821ab0f3d 34 elem = Ajax.getElementOrNull('ajax-trace-rs' ); if (elem) setDirection(elem, 10, 2);
andrewboyson 97:d9a821ab0f3d 35 elem = Ajax.getElementOrNull('ajax-trace-ar4' ); if (elem) setDirection(elem, 10, 3);
andrewboyson 97:d9a821ab0f3d 36 elem = Ajax.getElementOrNull('ajax-trace-ar6' ); if (elem) setDirection(elem, 11, 0);
andrewboyson 97:d9a821ab0f3d 37 elem = Ajax.getElementOrNull('ajax-trace-arp' ); if (elem) setDirection(elem, 11, 1);
andrewboyson 97:d9a821ab0f3d 38 elem = Ajax.getElementOrNull('ajax-trace-ip4' ); if (elem) setDirection(elem, 11, 2);
andrewboyson 97:d9a821ab0f3d 39 elem = Ajax.getElementOrNull('ajax-trace-ip6' ); if (elem) setDirection(elem, 11, 3);
andrewboyson 97:d9a821ab0f3d 40 elem = Ajax.getElementOrNull('ajax-trace-udp' ); if (elem) setDirection(elem, 12, 0);
andrewboyson 97:d9a821ab0f3d 41 elem = Ajax.getElementOrNull('ajax-trace-tcp' ); if (elem) setDirection(elem, 12, 1);
andrewboyson 97:d9a821ab0f3d 42 elem = Ajax.getElementOrNull('ajax-trace-http' ); if (elem) setDirection(elem, 12, 2);
andrewboyson 97:d9a821ab0f3d 43 elem = Ajax.getElementOrNull('ajax-trace-tftp' ); if (elem) setDirection(elem, 12, 3);
andrewboyson 14:c3c43c8faf0e 44 }
andrewboyson 14:c3c43c8faf0e 45
andrewboyson 97:d9a821ab0f3d 46 Ajax.server = '/trace-ajax';
andrewboyson 97:d9a821ab0f3d 47 Ajax.onResponse = display;
andrewboyson 97:d9a821ab0f3d 48 Ajax.init();