<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  
  <title>Thangaram Senthamaraikannan</title>
  <subtitle>Thangaram Senthamaraikannan, platform engineer in Chennai: what I wish existed, what went wrong, and what I built about it.</subtitle>
  <link href="https://thangaram611.github.io/feed.xml" rel="self" />
  <link href="https://thangaram611.github.io/" />
  <updated>2017-02-25T00:00:00Z</updated>
  <id>https://thangaram611.github.io/</id>
  <author>
    <name>Thangaram Senthamaraikannan</name>
  </author>
  <entry>
    <title>easy_Auth</title>
    <link href="https://thangaram611.github.io/projects/easy-auth/" />
    <updated>2017-02-25T00:00:00Z</updated>
    <id>https://thangaram611.github.io/projects/easy-auth/</id>
    <content type="html">&lt;p&gt;This was a security project from my college days. Three of us built it in nine commits between 25 February and 23 March 2017, and it was shown in a review. It was never offered to anyone. In November 2026 I installed it again, ran it and tried each part. This is what I found.&lt;/p&gt;
&lt;h2&gt;What it was meant to be&lt;/h2&gt;
&lt;p&gt;A site owner registers, picks plain login or two-factor, and gets a snippet to paste into their page. The snippet draws a login box that carries the owner&#39;s eight-character id. The visitors&#39; accounts live with the service, and the six-digit codes are the standard kind that authenticator apps produce.&lt;/p&gt;
&lt;p&gt;That is also what Auth0 and Authy were selling at the time, and I did not know they existed. So the fair question is how far this fell short of them.&lt;/p&gt;
&lt;h2&gt;Where it fell short&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Auth0 and Authy in 2017&lt;/th&gt;
&lt;th&gt;easy_Auth&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A stored password&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://web.archive.org/web/20170708154831/https://auth0.com/docs/connections/database&quot;&gt;hashed with bcrypt&lt;/a&gt;, one way&lt;/td&gt;
&lt;td&gt;encrypted, with a key anyone can rebuild from one line of the source&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proof of a login&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/auth0/docs/blob/4929e2cfaa1e07d8501e83f8a990c3aaa1c339b7/articles/tokens/id_token.md&quot;&gt;a signed token&lt;/a&gt; the site can check for itself&lt;/td&gt;
&lt;td&gt;the word &lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who may call&lt;/td&gt;
&lt;td&gt;each application keeps a secret key (&lt;a href=&quot;https://github.com/auth0/docs/blob/394dc130f391cc969cab0b7bc0c198b8f401dbc3/articles/applications.md&quot;&gt;Auth0&lt;/a&gt;, &lt;a href=&quot;https://web.archive.org/web/20170427222050/http://docs.authy.com/totp.html&quot;&gt;Authy&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;anyone who knows the id printed in the customer&#39;s page&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;What happened when I ran it&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;It did not start.&lt;/strong&gt; &lt;code&gt;index.js&lt;/code&gt; requires two packages that &lt;code&gt;package.json&lt;/code&gt; never lists, and the demo site that came with it was missing a third. There is no lockfile, so I installed today&#39;s versions of the 2017 ranges, on Node 6 and MongoDB 4.4.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The password came back.&lt;/strong&gt; The commit is titled &amp;quot;add encryption module&amp;quot;. It encrypts each password with a key generated from a passphrase, and the passphrase is in the source:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;var PassPhrase = &amp;quot;this is the security code&amp;quot;;
var MyRSAkey = cryptico.generateRSAKey(PassPhrase, Bits);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same passphrase gives the same key on any machine. I registered with the password &lt;code&gt;correct-horse-battery&lt;/code&gt;, copied the stored value out of the database, and three lines of code gave the password back. The server also printed each password to its log as it checked it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A wrong password opened the dashboard.&lt;/strong&gt; The login handler puts the email in the session before it checks the password, and the dashboard only asks whether an email is there. A wrong password got the answer &lt;code&gt;false&lt;/code&gt;, and then the dashboard.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Two people logging in at once were mixed up.&lt;/strong&gt; One variable holds the session for every visitor:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;var sess;
app.post(&#39;/checkregistered&#39;, function(req, res) {
	sess = req.session;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I sent two logins at the same moment, 200 times: the owner with the right password, and a stranger with an address that does not exist. The stranger&#39;s session ended up holding the owner&#39;s id 117 times. The owner&#39;s own session got it once.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The second factor could be guessed, and could stop the server.&lt;/strong&gt; The standard behind these codes says the server &lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc4226#section-7.3&quot;&gt;&amp;quot;needs to detect and stop brute force attacks&amp;quot;&lt;/a&gt;. The check took 3,000 wrong codes in 1.76 seconds and refused none. On my laptop that is one chance in twenty of a hit before the code changes. A check for an id that had no secret threw &lt;code&gt;Cannot read property &#39;secretkey&#39; of null&lt;/code&gt;, and the server was gone. Asking for a QR code twice left the first secret in force, so the second QR never worked.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In the demo site, the second factor guarded nothing.&lt;/strong&gt; The demo customer site, removed in the last commit, opened its dashboard right after the password, before any code was asked for. Then I entered &lt;code&gt;000000&lt;/code&gt;. The answer was &lt;code&gt;false&lt;/code&gt;, and the dashboard opened anyway. Every visitor&#39;s secret was filed under one id, the word &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A database login was in the history.&lt;/strong&gt; Five of the nine commits held the user name and password of a hosted database. They had been public since February 2017. The host no longer resolves.&lt;/p&gt;
&lt;h2&gt;What was missing&lt;/h2&gt;
&lt;p&gt;Not a tool. bcrypt had been on npm since 2011. The library I used for the codes already had a &lt;code&gt;verify&lt;/code&gt; call with a window for clock drift, published a year before the first commit. I called the other function and compared two strings.&lt;/p&gt;
&lt;p&gt;What was missing was what I did not know. A password is hashed, not encrypted. &amp;quot;Logged in&amp;quot; has to be something the other side can check. A secret in a commit stays in the history after the next commit removes it. Each of those is easy to get wrong, which is why the products existed.&lt;/p&gt;
&lt;h2&gt;What I did&lt;/h2&gt;
&lt;p&gt;I rewrote the history to take the database login out of the five commits that held it, and added a README that says what this was and that it must not be run. GitHub went on serving the old commits to anyone who had their hashes, so I deleted the repository, pushed the clean history to a new one of the same name, and archived that.&lt;/p&gt;
&lt;h2&gt;What this does not show&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The dependency versions are today&#39;s, not 2017&#39;s. Without a lockfile the original install cannot be rebuilt.&lt;/li&gt;
&lt;li&gt;What crossed between sessions was a customer id, which the customer&#39;s own page prints anyway. The finding is the mechanism.&lt;/li&gt;
&lt;li&gt;I describe Auth0 and Authy from what they published at the time. I had not used either.&lt;/li&gt;
&lt;li&gt;This is one small project read by its own author. I looked for what I now know to look for.&lt;/li&gt;
&lt;li&gt;The repository on GitHub was created in November 2026, when I replaced the old one. Its commits carry their 2017 dates, but for those you now have my word, not GitHub&#39;s.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>A login box any site can paste in</title>
    <link href="https://thangaram611.github.io/ideas/login-box/" />
    <updated>2017-02-25T00:00:00Z</updated>
    <id>https://thangaram611.github.io/ideas/login-box/</id>
    <content type="html">&lt;p&gt;A small site should not have to build its own login. Its owner picks what they want, a password or a password and a six-digit code, copies one snippet and pastes it in. Somebody else keeps the users and checks the codes.&lt;/p&gt;
&lt;p&gt;In February 2017 I thought that was a new idea. It was already two businesses. &lt;a href=&quot;https://auth0.com/blog/announcing-auth0/&quot;&gt;Auth0&lt;/a&gt; had launched four years earlier, and its paste-in login box was called Lock. Authy sold the six-digit code as an API, and &lt;a href=&quot;https://www.twilio.com/blog/2015/02/ahoy-authy-joins-twilio.html&quot;&gt;Twilio had bought it&lt;/a&gt; in February 2015. I had heard of neither.&lt;/p&gt;
</content>
  </entry>
</feed>