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 3:b58328ca6e70 1 #include "http.h"
andrewboyson 7:fd8c2c5eeea7 2 #include "settings.h"
andrewboyson 3:b58328ca6e70 3
andrewboyson 103:91194cc19bbb 4 void WebTraceQuery(char* pQuery)
andrewboyson 3:b58328ca6e70 5 {
andrewboyson 3:b58328ca6e70 6 while (pQuery)
andrewboyson 3:b58328ca6e70 7 {
andrewboyson 3:b58328ca6e70 8 char* pName;
andrewboyson 3:b58328ca6e70 9 char* pValue;
andrewboyson 34:30124e188ae1 10 pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
andrewboyson 3:b58328ca6e70 11
andrewboyson 33:68406cbde3e1 12 if (HttpSameStr(pName, "chg-send-dns-ip4" )) ChgDnsSendRequestsViaIp4();
andrewboyson 33:68406cbde3e1 13 if (HttpSameStr(pName, "chg-send-ntp-ip4" )) ChgNtpSendRequestsViaIp4();
andrewboyson 33:68406cbde3e1 14 if (HttpSameStr(pName, "chg-send-tftp-ip4" )) ChgTftpSendRequestsViaIp4();
andrewboyson 33:68406cbde3e1 15 if (HttpSameStr(pName, "set-trace-net-host" )) SetTraceNetHost(pValue);
andrewboyson 33:68406cbde3e1 16 if (HttpSameStr(pName, "chg-trace-net-stack" )) ChgTraceNetStack();
andrewboyson 33:68406cbde3e1 17 if (HttpSameStr(pName, "chg-trace-net-newline" )) ChgTraceNetNewLine();
andrewboyson 33:68406cbde3e1 18 if (HttpSameStr(pName, "chg-trace-net-verbose" )) ChgTraceNetVerbose();
andrewboyson 33:68406cbde3e1 19 if (HttpSameStr(pName, "chg-trace-link" )) ChgTraceLink();
andrewboyson 33:68406cbde3e1 20 if (HttpSameStr(pName, "chg-trace-dns-name" )) ChgTraceDnsName();
andrewboyson 33:68406cbde3e1 21 if (HttpSameStr(pName, "chg-trace-dns-query" )) ChgTraceDnsQuery();
andrewboyson 33:68406cbde3e1 22 if (HttpSameStr(pName, "chg-trace-dns-reply" )) ChgTraceDnsReply();
andrewboyson 33:68406cbde3e1 23 if (HttpSameStr(pName, "chg-trace-dns-server" )) ChgTraceDnsServer();
andrewboyson 33:68406cbde3e1 24 if (HttpSameStr(pName, "chg-trace-ntp" )) ChgTraceNtp();
andrewboyson 33:68406cbde3e1 25 if (HttpSameStr(pName, "chg-trace-dhcp" )) ChgTraceDhcp();
andrewboyson 33:68406cbde3e1 26 if (HttpSameStr(pName, "chg-trace-ns-recv-sol" )) ChgTraceNsRecvSol();
andrewboyson 33:68406cbde3e1 27 if (HttpSameStr(pName, "chg-trace-ns-recv-adv" )) ChgTraceNsRecvAdv();
andrewboyson 33:68406cbde3e1 28 if (HttpSameStr(pName, "chg-trace-ns-send-sol" )) ChgTraceNsSendSol();
andrewboyson 33:68406cbde3e1 29 if (HttpSameStr(pName, "chg-trace-nr4" )) ChgTraceNr4();
andrewboyson 33:68406cbde3e1 30 if (HttpSameStr(pName, "chg-trace-nr6" )) ChgTraceNr6();
andrewboyson 33:68406cbde3e1 31 if (HttpSameStr(pName, "chg-trace-ntp-client" )) ChgTraceNtpClient();
andrewboyson 33:68406cbde3e1 32 if (HttpSameStr(pName, "chg-trace-sync" )) ChgTraceSync();
andrewboyson 33:68406cbde3e1 33 if (HttpSameStr(pName, "chg-trace-echo4" )) ChgTraceEcho4();
andrewboyson 33:68406cbde3e1 34 if (HttpSameStr(pName, "chg-trace-echo6" )) ChgTraceEcho6();
andrewboyson 33:68406cbde3e1 35 if (HttpSameStr(pName, "chg-trace-dest6" )) ChgTraceDest6();
andrewboyson 33:68406cbde3e1 36 if (HttpSameStr(pName, "chg-trace-ra" )) ChgTraceRa();
andrewboyson 33:68406cbde3e1 37 if (HttpSameStr(pName, "chg-trace-rs" )) ChgTraceRs();
andrewboyson 33:68406cbde3e1 38 if (HttpSameStr(pName, "chg-trace-ar4" )) ChgTraceAr4();
andrewboyson 33:68406cbde3e1 39 if (HttpSameStr(pName, "chg-trace-ar6" )) ChgTraceAr6();
andrewboyson 33:68406cbde3e1 40 if (HttpSameStr(pName, "chg-trace-arp" )) ChgTraceArp();
andrewboyson 33:68406cbde3e1 41 if (HttpSameStr(pName, "chg-trace-ip4" )) ChgTraceIp4();
andrewboyson 33:68406cbde3e1 42 if (HttpSameStr(pName, "chg-trace-ip6" )) ChgTraceIp6();
andrewboyson 33:68406cbde3e1 43 if (HttpSameStr(pName, "chg-trace-udp" )) ChgTraceUdp();
andrewboyson 33:68406cbde3e1 44 if (HttpSameStr(pName, "chg-trace-tcp" )) ChgTraceTcp();
andrewboyson 33:68406cbde3e1 45 if (HttpSameStr(pName, "chg-trace-http" )) ChgTraceHttp();
andrewboyson 33:68406cbde3e1 46 if (HttpSameStr(pName, "chg-trace-tftp" )) ChgTraceTftp();
andrewboyson 3:b58328ca6e70 47 }
andrewboyson 3:b58328ca6e70 48 }
andrewboyson 3:b58328ca6e70 49