<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Tari R. Alfaro</title>
    <description>The latest articles on Forem by Tari R. Alfaro (@tarialfaro).</description>
    <link>https://forem.com/tarialfaro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F143677%2Fe8c0189f-6ed4-4e4a-99c7-a18d7fc87efe.png</url>
      <title>Forem: Tari R. Alfaro</title>
      <link>https://forem.com/tarialfaro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tarialfaro"/>
    <language>en</language>
    <item>
      <title>Preventing malicious authentication attempts while avoiding CAPTCHAs.</title>
      <dc:creator>Tari R. Alfaro</dc:creator>
      <pubDate>Sat, 08 Jun 2019 01:39:11 +0000</pubDate>
      <link>https://forem.com/tarialfaro/preventing-malicious-authentication-attempts-while-avoiding-captchas-3bpl</link>
      <guid>https://forem.com/tarialfaro/preventing-malicious-authentication-attempts-while-avoiding-captchas-3bpl</guid>
      <description>&lt;p&gt;It's imperative that we protect credentials with great care, such as properly hashing the low entropy secrets with algorithms like &lt;a href="https://argon2.com/"&gt;Argon2&lt;/a&gt; or &lt;a href="https://www.tarsnap.com/scrypt.html"&gt;Scrypt&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Multiple factors of authentication is important to protecting accounts. Such as having knowledge of a secret and in possession of something.&lt;/p&gt;

&lt;p&gt;Despite properly implementing cryptography and management of credentials, there are still issues such as malicious third-parties attempting to gain access to accounts. And it's hard stopping that all together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Just use CAPTCHAs! Hold your thought on that.
&lt;/h2&gt;

&lt;p&gt;Usually it's still possible to attack a lot of services by trying well known "secrets" against a bunch of accounts. Some services attempt to prevent this with &lt;a href="https://wikipedia.org/wiki/captcha"&gt;CAPTCHAs&lt;/a&gt;(&lt;a href="http://captcha.net/"&gt;official site&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;One thing I've noticed is that CAPTCHAs are either accessible or sufficiently resistant to automated actions. Often it's not both. Sometimes it's neither! Even though I don't have any disabilities, I still have a hard time completing them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.google.com/recaptcha/intro/v3.html"&gt;Google's reCAPTCHA&lt;/a&gt; a lot of the time doesn't like &lt;a href="https://torproject.org/"&gt;Tor&lt;/a&gt; network activity often rejecting valid CAPTCHA answers due to "possible automated queries". Usually the solution I found is to switch up the exit node. It's an issue with popular proxies and VPNs, not just Tor users. &lt;a href="https://fossbytes.com/google-knows-using-tor/"&gt;More information here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately I don't know of any decent free open-source privacy respecting alternatives to Google's CAPTCHAs.&lt;/p&gt;

&lt;p&gt;So CAPTCHAs may not be the best choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  My solution.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The foreign account.
&lt;/h3&gt;

&lt;p&gt;For each set of credentials that is stored, there is also a unique &lt;strong&gt;foreign account&lt;/strong&gt; associated with it, this could be a email, XMPP or phone number that the authentic individual is in possession of.&lt;/p&gt;

&lt;h3&gt;
  
  
  The data.
&lt;/h3&gt;

&lt;p&gt;There has to be some sort of data sent to the foreign account to prove they have access to it. The data MUST be &lt;em&gt;ephemeral&lt;/em&gt; and &lt;em&gt;random&lt;/em&gt;. This could be a software token attached to a link where a few authentication attempts are permitted. Or a secret(e.g: 8 digit code) that can easily be typed in.&lt;/p&gt;

&lt;p&gt;To securely store the data, and verify the foreign account access data, it must be hashed properly. Generally the secret is low entropy, so we should store it with Argon2 or Scrypt.&lt;/p&gt;

&lt;p&gt;However if the data comes from a &lt;a href="https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator"&gt;CSPRNG&lt;/a&gt; output with &amp;gt;= 128 bits of entropy, we use an easy to compute hashing function. Take the &lt;a href="https://blake2.net/"&gt;BLAKE2&lt;/a&gt; hashing algorithm for example.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For defense in depth or as an alternative strategy: Use asymmetric cryptography to ensure only the authentic individual may access the data. This could be sent to the associated foreign account or given right away.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Example secret(easy to type in):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;8 1 7 1 5 9 4 6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Example link(far less guessable):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://application.network/authenticate/d96c7bf0c9faf4c2c80a2d7e087aa258
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  The locking mechanism.
&lt;/h3&gt;

&lt;p&gt;Now that there are two very important pieces to the puzzle gathered, that being &lt;strong&gt;the foreign account&lt;/strong&gt; and &lt;strong&gt;the data&lt;/strong&gt;. We have one final piece to gather.&lt;/p&gt;

&lt;p&gt;What are we going to do with those two pieces? They can be used as a form of two-factor authentication.&lt;/p&gt;

&lt;p&gt;By definition "locking" means to apply that 2FA. Of course we could constantly apply it(preventing nearly all malicious authentication attempts), however ... we can try to make &lt;em&gt;educated guesses&lt;/em&gt; to only apply the 2FA when it's possible there is an attack on the account.&lt;/p&gt;

&lt;p&gt;Which means it's possible to make the accounts a lot more secure while retaining usability.&lt;/p&gt;

&lt;h4&gt;
  
  
  What do we lock, when and for how long?
&lt;/h4&gt;

&lt;p&gt;We can lock an IP that attempted to authenticate and failed a certain number of times within a certain time period. If we lock an IP, it's global. Meaning that IP is not allowed to attempt to authenticate on &lt;em&gt;any&lt;/em&gt; accounts without verifying foreign account access. This goes for whitelisted IPs as well.&lt;/p&gt;

&lt;p&gt;There is one other way to handle IPs. Each account could have whitelisted IPs that avoid the lock(only if the whitelisted IPs aren't locked), while any unrecognized IPs are automatically required to go through lock, even if the IPs themselves aren't locked. This could provide some better security while still retaining some usability.&lt;/p&gt;

&lt;p&gt;Another method is locking by account. If a certain number of authentication attempts fail within a certain time period, it'll be locked. Meaning &lt;strong&gt;no IPs&lt;/strong&gt; may attempt to authenticate on this account. That includes whitelisted IPs.&lt;/p&gt;

&lt;p&gt;The only effective way of defending against attacks is to use both methods. Locking by IP and account, preferably with the same allowed authentication fail attempts before locking.&lt;/p&gt;

&lt;p&gt;We can't completely rely on the first method because most experienced attackers know that they can just switch up their IP with a proxy.&lt;/p&gt;

&lt;p&gt;We also can't completely rely on the second method because one IP could just attack all of the accounts. Instead we use both methods to prevent both issues.&lt;/p&gt;

&lt;p&gt;However it's better to only have the second method than to only have the first. And it's best to have &lt;em&gt;both&lt;/em&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If an account is allowed 3 failed attempts within 24 hours, and an IP is allowed 6 failed attempts within 24 hours ... they can use &lt;em&gt;one&lt;/em&gt; IP to attack &lt;em&gt;two&lt;/em&gt; accounts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If an account is allowed 6 invalid authentication attempts within 24 hours, and an IP is allowed 3 failed attempts within 24 hours, we can use &lt;em&gt;two&lt;/em&gt; IPs to attack &lt;em&gt;one&lt;/em&gt; account. This can be worse than 1) because more attempts are available to each account.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For how long the account or IP is locked could fixed, incremental(depending on how many times it was previously locked), or randomized.&lt;/p&gt;

&lt;p&gt;There are a few other things to take into consideration. You could make accurate educated guesses by determining how many requests there are to authenticate with which IP, and which account. Monitor and automatically lock all accounts for a certain period of time if you're 99% sure there is a possible attack on a bunch of accounts and warn the users that there is probably an attack that was prevented.&lt;/p&gt;

&lt;p&gt;It's one area I'm still exploring, how to accurately determine whether there are attacks ongoing. (Although from my understanding it's extremely hard, it would require a lot of math, possibly even an AI.)&lt;/p&gt;

&lt;p&gt;This was my alternative for authentication forms. This isn't meant to replace CAPTCHAs, it's meant to avoid them as much as possible and provide a more secure and accessible solution when authenticating.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The most secure solution is to always apply the 2FA, use asymmetric cryptography and a high entropy piece of data, such as the software token attached to a link. But this is too inconvenient for average users.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Take note that if you're not already logged into your email assuming that's what you use for the foreign account, then the email service could require CAPTCHAs during the sign in process.&lt;/p&gt;

&lt;p&gt;If you have any questions or you'd like to discuss anything, contact me via &lt;a href="//mailto:tari-alfaro@keemail.me"&gt;email&lt;/a&gt;, &lt;a href="https://mastodon.technology/@tari_alfaro"&gt;Mastodon&lt;/a&gt;, &lt;a href="https://forum.privacytools.io/u/tari-alfaro"&gt;the forum&lt;/a&gt;, &lt;a href="https://dev.to/tarialfaro"&gt;DEV.to&lt;/a&gt; or &lt;a href="//xmpp:tari-alfaro@xmpp.is"&gt;XMPP&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://write.privacytools.io/tari-alfaro/preventing-malicious-authentication-attempts-while-avoiding-captchas"&gt;Cross posted from here.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>authentication</category>
      <category>a11y</category>
    </item>
    <item>
      <title>Block malicious login attempts, but preventing account lock-outs.</title>
      <dc:creator>Tari R. Alfaro</dc:creator>
      <pubDate>Tue, 07 May 2019 00:07:11 +0000</pubDate>
      <link>https://forem.com/tarialfaro/block-malicious-login-attempts-but-preventing-account-lock-outs-4hpi</link>
      <guid>https://forem.com/tarialfaro/block-malicious-login-attempts-but-preventing-account-lock-outs-4hpi</guid>
      <description>&lt;h2&gt;
  
  
  How would you prevent malicious login attempts?
&lt;/h2&gt;

&lt;p&gt;I'm curious how the DEV developers(those interested in security) here would prevent malicious login attempts.&lt;/p&gt;

&lt;h3&gt;
  
  
  My solution.
&lt;/h3&gt;

&lt;p&gt;If a IP(e.g: &lt;code&gt;127.0.0.1&lt;/code&gt;) had failed to authenticate 3 or more times within a 12 hour period, block any further login attempts for 24 hours. This is global, this IP may not attempt to login to any accounts, not just that one account.&lt;/p&gt;

&lt;p&gt;If 3 or more IPs have exceeded the 3 failed attempts on a specific account, &lt;strong&gt;all&lt;/strong&gt; IPs are required to supply the federated account, on that &lt;em&gt;specific&lt;/em&gt; account.&lt;/p&gt;

&lt;p&gt;During those 24 hours of "blocked" login attempts, they are required to supply the account's federated account, such as an email(e.g: &lt;code&gt;you@mail.com&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If they supply the correct federated account, email in this case, the server will send a special randomly generated link to &lt;code&gt;you@mail.com&lt;/code&gt; that email that temporarily lets you bypass the blocked login attempts.&lt;/p&gt;

&lt;p&gt;That link is valid for a short amount of time, e.g: 5-15 minutes.&lt;/p&gt;

&lt;p&gt;You provide your credentials and you're logged in. However if the credentials are invalid twice, set a cool-down time of 60 minutes before another link may be sent.&lt;/p&gt;

&lt;p&gt;If the attacker has access to your email, then you have a lot more problems. But this thwarts brute-force attacks directly against your credentials, while still being able to gain access to your account.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Remember, the goal is to prevent malicious third-parties from attempting to gain access to the account, while not blocking access for the actual people.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>authentication</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Be educated about today's security.</title>
      <dc:creator>Tari R. Alfaro</dc:creator>
      <pubDate>Thu, 02 May 2019 01:51:28 +0000</pubDate>
      <link>https://forem.com/tarialfaro/be-educated-about-today-s-security-1c9a</link>
      <guid>https://forem.com/tarialfaro/be-educated-about-today-s-security-1c9a</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclaimer: Security is a moving and vast subject. Stay updated! What is secure today could be insecure tomorrow.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Second disclaimer: Sorry for any errors in this post. It's really long, and I'm not a editor.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links could be broken in the future.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Category:Security"&gt;Security&lt;/a&gt; has &lt;em&gt;many&lt;/em&gt; sub categories, and it all really depends on what the context is. It is probably one of the most complex subjects of today. I will cover &lt;em&gt;a lot&lt;/em&gt; of topics in this article, but not all. Security is extremely vast, there is more to it than cryptography.&lt;/p&gt;

&lt;p&gt;If you're a developer, take a &lt;a href="https://timoh6.github.io/WebAppSecQuiz/"&gt;web application security quiz,&lt;/a&gt; and look at some &lt;a href="https://latacora.singles/2018/04/03/cryptographic-right-answers.html"&gt;cryptographic right answers.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Security is important, spread the word, participate, share your knowledge(preferably without being rude).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I go over some &lt;em&gt;myths, attack vectors, best practices and resources.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Alright! Let's go over some myths.
&lt;/h2&gt;

&lt;p&gt;Yep, myth busting time.&lt;/p&gt;

&lt;h3&gt;
  
  
  "VPNs provide anonymity." (No, they don't.)
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.privateinternetaccess.com/"&gt;Private Internet Access&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Private Internet Access® VPN Service encrypts your connection and provides you with an &lt;strong&gt;anonymous IP&lt;/strong&gt; to protect your privacy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://protonvpn.com/"&gt;ProtonVPN&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Keep your browsing history private. As a Swiss VPN provider, we do not log user activity or share data with third parties. Our &lt;strong&gt;anonymous VPN&lt;/strong&gt; service enables Internet without surveillance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://nordvpn.com/"&gt;NordVPN&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine VPN as a &lt;strong&gt;hack-proof&lt;/strong&gt;, encrypted tunnel for online traffic to flow. Nobody can see through the tunnel and get their hands on your internet data. NordVPN gives you peace of mind each time you use public Wi-Fi, access personal and work accounts on the road, or want to keep your browsing history to yourself.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nothing is hack-proof. No one is 100% anonymous. VPNs do not provide anonymity. VPNs see everything your ISP does. The question is, &lt;em&gt;do you trust your VPN provider more than your ISP?&lt;/em&gt; VPNs are great for bypassing censorship and preventing ISPs from seeing requests you make through the internet.&lt;/p&gt;

&lt;p&gt;It's good practice to use a VPN to encrypt your internet traffic when you're using public WiFi.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;But Tari, VPNs mask your IP!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yes, I know that. But that's not the only factor in obtaining anonymity.&lt;/p&gt;

&lt;p&gt;If you're looking for anonymity, check out &lt;a href="https://torproject.org/"&gt;Tor Project&lt;/a&gt; and &lt;a href="https://geti2p.net/"&gt;I2P&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  "I don't need anti-virus on a UNIX-like machine." (Yes, you do.)
&lt;/h3&gt;

&lt;p&gt;Just because you are using a UNIX-like machine does not make you immune to virus. &lt;em&gt;Generally&lt;/em&gt; it's less common for there to be viruses for them, mostly because a lot of viruses are targeting Windows and MacOS users. I am referring to desktop use, not servers.&lt;/p&gt;

&lt;p&gt;This does not mean anti-virus programs are a silver-bullet. Don't click on those phishy Facebook messages with "Check out yourself in this YouTube video!". Don't. Click. Random. Links.&lt;/p&gt;

&lt;p&gt;Check out &lt;a href="https://clamav.net/"&gt;ClamAV&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common sense is important!&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  "I am not important, hackers won't target me." (Yes they will, speaking from experience.)
&lt;/h3&gt;

&lt;p&gt;Often, many people have many accounts on the internet for many services. Hulu, Netflix, banking, etc.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Banking&lt;/em&gt; is sensitive. Some people have bank accounts, with money in them. Why wouldn't a hacker want your money, or your credit card information? Or your Amazon account to buy stuff?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;True story, my Mom's Hulu account got attacked by a malicious third-party. And my Dad's email and Amazon account were breached. Yes, this was recent, only a couple/few months ago.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  "I must trade my privacy for security." (No you don't.)
&lt;/h3&gt;

&lt;p&gt;Privacy is a &lt;em&gt;category&lt;/em&gt; of security. Cryptography helps maintain your privacy. Conversations between you and your therapist are supposed to be confidential, private, secret.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.merriam-webster.com/dictionary/confidential"&gt;Definition of confidential ...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cryptography can be used in a way to ensure that secrets stay secret(Or private things stay private).&lt;/p&gt;

&lt;h4&gt;
  
  
  Example
&lt;/h4&gt;

&lt;p&gt;Let's say you're signing into a service. They log your IP, user agent, device, etc. It's stored in plaintext. &lt;em&gt;NO!&lt;/em&gt; They could encrypt it so &lt;em&gt;&lt;strong&gt;only&lt;/strong&gt; you&lt;/em&gt; could see the list of authenticated IPs and user agents. They could also hash them, and compare. If they don't match, send information saying that &lt;em&gt;potentially&lt;/em&gt; there is a suspicious authentication action going on, and require additional authentication factors for that session trying to sign in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Privacy is not anonymity!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving onto attack vectors and vulnerabilities.
&lt;/h2&gt;

&lt;p&gt;This section is geared towards developers. There are so many attack vectors. I will only be going over a &lt;em&gt;few.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;SQL Injection; XML External Entities; Session Fixation; Weak Session Identifiers; Cross-Site Request Forgery; Cross-Site Scripting; Reflected Cross-Site Scripting; Command Execution; Click Jacking; Directory Traversal; Document-Object-Mapping Based Cross-Site Scripting; File Upload Vulnerabilities; Broken Access Control; Open Redirects; Unencrypted Communications; Data Mismanagement;&lt;/p&gt;

&lt;h3&gt;
  
  
  XXE/XEE. &lt;a href="https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Processing"&gt;Read more ...&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;XML has some security issues. Things like XML External Entities (XXE/XEE) are possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  XSS. &lt;a href="https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)"&gt;Read more ...&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;There is more to Cross-Site Scripting (XSS) than simple &lt;code&gt;alert(1)&lt;/code&gt;. &lt;em&gt;Much more.&lt;/em&gt; It is a complex subject, issues like these are &lt;strong&gt;STILL&lt;/strong&gt; around today. Because there are different parsers for JS, HTML, CSS, that means they parse things differently from each other. And that means it can be hard to push security updates.&lt;/p&gt;

&lt;p&gt;This is a parser differential issue, and there are &lt;em&gt;many&lt;/em&gt; different ways to attack different browsers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md"&gt;This post is already really long. Learn to mitigate XSS.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  SQLi. &lt;a href="https://www.owasp.org/index.php/SQL_injection"&gt;Read more ...&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;SQL Injection (SQLi) is for &lt;em&gt;the most part&lt;/em&gt; solved. It's mostly due to legacy projects. However vulnerabilities still popup, but they are &lt;em&gt;usually&lt;/em&gt; spotted and patched quickly.&lt;/p&gt;

&lt;p&gt;Make sure to use &lt;em&gt;prepared SQL statements&lt;/em&gt; to avoid these issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  Session fixation. &lt;a href="https://www.owasp.org/index.php/Session_fixation"&gt;Read more ...&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;The most common place for session identifiers are usually in cookies. Things like XSS can extract the session identifier &lt;strong&gt;IF&lt;/strong&gt; the flag &lt;code&gt;http_only&lt;/code&gt; is set to &lt;code&gt;false&lt;/code&gt;, well, as far as I know.&lt;/p&gt;

&lt;p&gt;If anyone has this, they can be logged into your account.&lt;/p&gt;

&lt;p&gt;Make sure only HTTP may access the session identifier cookies. Destroy XSS vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't store session identifiers in JavaScript localStorage! No, I don't have a solution/alternative other than build a native desktop and mobile applications.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Weak session identifier. &lt;a href="https://www.owasp.org/index.php/Session_Prediction"&gt;Read more ...&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;A low entropy/easily guessable session identifier makes it easy for attackers to pose as an authenticated session.&lt;/p&gt;

&lt;p&gt;The solution would be to create a &lt;a href="https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator"&gt;CSPRNG&lt;/a&gt; 256-bit session identifier. The attacker would have to guess 2^256 possibilities, which would just take too long. &lt;strong&gt;Hash this session identifier, then store it on the client.&lt;/strong&gt; Hashing it is important in case there was a issue with the CSPRNG.&lt;/p&gt;

&lt;h4&gt;
  
  
  Improper storage.
&lt;/h4&gt;

&lt;p&gt;Not hashing the session identifier on the server could create issues. If a attacker breaches the server, they could be authenticated as &lt;em&gt;any&lt;/em&gt; individual. In this instance, the server administrator is also the attacker, since they have access to session identifiers.&lt;/p&gt;

&lt;p&gt;Hash the session identifier with a good algorithm. Preferably SHA2 family/SHA3 family/Blake2b. &lt;strong&gt;Yes! Hash it again here.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Cookie tampering.
&lt;/h3&gt;

&lt;p&gt;Cookies are stored on individuals' devices. They have complete control over it. They can edit it, delete it, make cookies, etc. They cannot be trusted.&lt;/p&gt;

&lt;p&gt;The solution is to use digital signatures to ensure that cookie values are not tampered with. If the value doesn't match up with the digital signature, report it, make it scream, &lt;strong&gt;AND DO NOT USE THE COOKIE VALUE.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Best practices.
&lt;/h2&gt;

&lt;p&gt;Follow along with these best practices, and be sure to suggest these to your family, friends, acquaintances and strangers. This section is geared towards the average user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Secure your passwords/passphrases.
&lt;/h3&gt;

&lt;p&gt;You should be using &lt;a href="http://world.std.com/~reinhold/diceware.html"&gt;diceware passphrases&lt;/a&gt; to protect your password manager, device login, and wherever else a password manager isn't appropriate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use a password manager.
&lt;/h3&gt;

&lt;p&gt;You probably have lots of credentials. Use a password manager to secure your data. There are many of them. Stick with free open-source solutions because developers &lt;em&gt;can verify&lt;/em&gt; the security of the applications.&lt;/p&gt;

&lt;p&gt;I recommend &lt;a href="https://keepassxc.org/"&gt;KeePassXC&lt;/a&gt; for desktop, and &lt;a href="https://keepassdx.com/"&gt;KeePassDX&lt;/a&gt; for Android-based devices. There is also &lt;a href="https://bitwarden.com/"&gt;BitWarden.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Use multiple factors of authentication wherever possible.
&lt;/h3&gt;

&lt;p&gt;Things like &lt;a href="https://www.yubico.com/"&gt;Hardware Security Keys&lt;/a&gt;, TOTP authenticator applications, email and SMS OTPs are great for securing your accounts. Use them wherever possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE: SMS two-factor authentication is insecure, but it's better than no two-factor authentication.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Double check links.
&lt;/h3&gt;

&lt;p&gt;Make sure you are double checking links, and not trusting random ones at that. Do not click them if they seem suspicious.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use anti-virus and firewall software.
&lt;/h3&gt;

&lt;p&gt;Make sure to use anti-virus software on your systems, and a firewall too.&lt;/p&gt;




&lt;h2&gt;
  
  
  Stay informed and learn from good sources.
&lt;/h2&gt;

&lt;p&gt;Do note that some(ahem, &lt;em&gt;a lot&lt;/em&gt;) of these links are geared towards people who understand technical details about certain subjects. I am being vague for a reason, because the subjects vary.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All&lt;/em&gt; these I have personally been using for a while.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://doesmysiteneedhttps.com/"&gt;Does my site need HTTPS?&lt;/a&gt; Definitely.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hacksplaining.com/"&gt;Hacksplaining.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://latacora.singles/"&gt;Latacora blog.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://paragonie.com/blog/"&gt;ParagonIE blog.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/t/security"&gt;Dev.to&lt;/a&gt; Duh! You're here.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crypto.stackexchange.com/"&gt;Crypto stack exchange.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://security.stackexchange.com/"&gt;Security stack exchange.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://websec.io/"&gt;websec.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://infosec-handbook.eu/"&gt;InfoSec HandBook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://eff.org/"&gt;Electronic Frontier Foundation.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://news.ycombinator.com/"&gt;Hacker News.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.cryptographyengineering.com/"&gt;Crypto Engineering blog.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.schneier.com/"&gt;Schneier on security.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://liveoverflow.com/"&gt;Live Overflow site.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.owasp.org/index.php/Main_Page"&gt;OWASP.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Sub-reddits.

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/netsec/"&gt;Netsec subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/security/"&gt;Security subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/privacy/"&gt;Privacy subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/crypto/"&gt;Crypto subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/cryptography/"&gt;Cryptography subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/websec/"&gt;Websec subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/codes/"&gt;Codes subreddit. For non-standardized ciphers.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/compsec/"&gt;Compsec subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/stanfordcrypto/"&gt;Stanfordcrypto subreddit.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Youtube.

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC1usFRN4LCMcfIV7UjHNuQg/videos"&gt;Introduction to Cryptography with Christof Paar.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCW6MNdOsqv2E9AjQkv9we7A"&gt;PwnFunction.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w"&gt;Live Overflow.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/user/RootOfTheNull/videos"&gt;John Hammond.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UCjr2bPAyPV7t35MvcgT3W8Q"&gt;The Hated One.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/channel/UC9-y-6csu5WGm29I7JiwpnA"&gt;Computerphile.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Don't be afraid. Share your thoughts and resources below.&lt;/p&gt;

</description>
      <category>security</category>
    </item>
    <item>
      <title>Clients and Servers</title>
      <dc:creator>Tari R. Alfaro</dc:creator>
      <pubDate>Tue, 23 Apr 2019 22:53:06 +0000</pubDate>
      <link>https://forem.com/tarialfaro/clients-and-servers-548e</link>
      <guid>https://forem.com/tarialfaro/clients-and-servers-548e</guid>
      <description>&lt;p&gt;I think that we should be trusting clients more than servers to handle our data for us.&lt;/p&gt;

&lt;p&gt;Servers should try to focus more on performance and availability rather than individuals' security. This does not mean to disregard security at all! This just means servers should focus on securing &lt;em&gt;themselves&lt;/em&gt; and the &lt;em&gt;communications&lt;/em&gt; between clients and other servers.&lt;/p&gt;

&lt;p&gt;Clients should provide confidentiality, authentication and integrity with cryptography for the individual. The clients themselves could be cryptographically signed, free open-source software with reproducible binaries. Anyone with the technical skill can audit the source code themselves. And if it's community based, also contribute!&lt;/p&gt;

&lt;p&gt;Most importantly, clients are local while servers are remote. Meaning it is typically a lot harder to directly attack clients rather than servers, especially if individuals protected themselves adequately. Some might be easy targets. It all depends. This makes it harder to attack a whole audience if there is no easy way to distribute their attacks to everyone.&lt;/p&gt;

&lt;p&gt;If that doesn't make any sense, think of it like this. The attacker would need to create malware for a specific operating system. Some of the audience might be using Android, iOS, Linux, MacOS, Windows, FreeBSD, etc. That is only one variable, there are many more. I am sure there are ways to distribute malware to multiple OSs.&lt;/p&gt;

&lt;p&gt;So again, this allows client developers to focus on individuals' security, such as automatic secure updates, hashing their passphrases and encrypting confidential data before leaving the device. While servers focus &lt;em&gt;more&lt;/em&gt; on storing and structuring data, performance and availability rather than individuals' security.&lt;/p&gt;

&lt;p&gt;No, this does not mean client developers should overlook performance or availability either. But you should trust clients more than servers with your data.&lt;/p&gt;

&lt;p&gt;This does make the client developers a much larger target, and wherever their client source-code is stored. But that is why they should be cryptographically signing their software.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;So what are your thoughts on this?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Passphrases and Key Files</title>
      <dc:creator>Tari R. Alfaro</dc:creator>
      <pubDate>Mon, 15 Apr 2019 01:17:06 +0000</pubDate>
      <link>https://forem.com/tarialfaro/passphrases-and-key-files-3406</link>
      <guid>https://forem.com/tarialfaro/passphrases-and-key-files-3406</guid>
      <description>&lt;p&gt;&lt;strong&gt;WARNING: Complex and vast subject.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can use key files for both &lt;a href="https://veracrypt.fr/"&gt;VeraCrypt volumes&lt;/a&gt; and &lt;a href="https://keepassxc.org/"&gt;KeePass databases&lt;/a&gt; to cryptographically secure encryption keys.&lt;/p&gt;

&lt;p&gt;The user would upload a file or a few as key file(s), along side their passphrase.&lt;/p&gt;

&lt;p&gt;Put aside the target audience, average Joe probably wouldn't want to upload key file(s) every time they logged in along side their passphrase.&lt;/p&gt;

&lt;p&gt;I see this in one case where it helps.&lt;/p&gt;

&lt;p&gt;The database gets breached and the attacker only has the hashes, but doesn't know if they used key files or not to use as a pepper for their passphrase. And if hashes were appended/prepended to the passphrase it would make it more secure, right?&lt;/p&gt;

&lt;p&gt;For each file that the user uploads, we will hash their contents and append them to the passphrase when it gets hashed.&lt;/p&gt;

&lt;p&gt;There is many ways we could go about it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;passphrase = passphraseHash(passphrase + key_file_hashes)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Note: If there is more than one key file, the order that the key files would go in matters!&lt;/p&gt;

&lt;p&gt;From the way I am seeing it, it is a proper "pepper" since it's user provided, etc.&lt;/p&gt;

&lt;p&gt;There is many possibilities. The key file could be obfuscated in a folder with 1000s of files.&lt;/p&gt;

&lt;p&gt;Where else could this help? Where would this bring pitfalls?&lt;/p&gt;

&lt;p&gt;Thoughts? Please share them!&lt;/p&gt;

</description>
      <category>security</category>
      <category>authentication</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
