<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media = "http://search.yahoo.com/mrss/" version="2.0">
  <channel>
    <title>Identity and Access Control on Michée Lengronne</title>
    <link>https://michee.io/en-us/series/identity-and-access-control/</link>
    <image>
      <url>https://michee.io/logo.png</url>
      <title>Identity and Access Control on Michée Lengronne</title>
      <link>https://michee.io/en-us/series/identity-and-access-control/</link>
    </image>
    <description>Expertise in Platform, Big Data, DevOps, IT security (DevSecOps) and Opensource</description>
    <language>en-us</language>
    <lastBuildDate>Wed, 05 Nov 2025 16:00:00 +0000</lastBuildDate><atom:link href="https://michee.io/en-us/series/identity-and-access-control/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>The authentication chain</title>
      <link>https://michee.io/en-us/posts/the-authentication-chain/</link>
      <pubDate>Wed, 05 Nov 2025 16:00:00 +0000</pubDate>
      <guid>https://michee.io/en-us/posts/the-authentication-chain/</guid>
      <description>Connecting to a service, a system, or a website is a process that’s a bit more complex than one might think.</description>
      <content:encoded><![CDATA[<p>This series of articles simply explains the processes and best practices for logging in.</p>
<p>Note: This post was translated from french with the help of AI. The original post was written with the knowledge of a younger me.</p>
<h2 id="step-1-the-basics">Step 1, the basics</h2>
<p>We start at the beginning. The very first step is the password, the most common authentication method.</p>
<p>What makes a good password, how to best manage the multitude of passwords.</p>
<blockquote>
<p>
<a href="https://michee.io/en-us/posts/all-about-a-good-password/">All about a good password</a></p></blockquote>
<p>For developers, this article explains how to manage password authentication on your system.
Note, the recommendations in this article are valid for the first quarter of 2019.
If you read this article in 2038 (well hello to transdimensionals already,
or &ldquo;−··· −−− −· ·−−− −−− ··− ·−· ·−−·− ·−·· ·−−−−· ·· −· − · −· − ·· −−− −· −·· · ·−·· ·− −−· ·−· −−− ··· ··· · ···− −−− ·· −··−  &quot; in your language),
the recommendations will probably (surely) be outdated.</p>
<blockquote>
<p>
<a href="https://michee.io/en-us/posts/implementations-of-the-passphrase/">Passphrase implementations</a></p></blockquote>
<h2 id="step-2-strengthening">Step 2, strengthening</h2>
<p>Once the password is set (so no more &ldquo;1234567890&rdquo;), we move to the second step (which is aptly named).</p>
<p>Two-factor authentication is based on the principle &ldquo;Something you know, something you have.&rdquo;</p>
<blockquote>
<p>
<a href="https://michee.io/en-us/posts/all-about-two-factor-authentication/">All about two-factor authentication</a></p></blockquote>
<h2 id="step-3-distributing-authentication">Step 3, distributing authentication</h2>
<p>Once authenticated on one system, why do it again on others? It is error-prone and not very pleasant.</p>
<p>There is a solution that allows you to securely distribute your authentication.
With this solution, you authenticate to one service and other services, systems, websites you use can recognize your identity and authenticate you on demand without repeating the first two steps.</p>
<blockquote>
<p>
<a href="https://michee.io/en-us/posts/social-logins-how-do-they-work/">Social logins, how do they work?</a></p></blockquote>
<h2 id="step-4-access-control">Step 4, access control</h2>
<p>Once authenticated, you do not have access to all the resources provided by services either.
There are rules to select what you can access and what is denied.
Users of a service are organized according to groups or roles.
What on social networks is called tribe, clan, horde, community, committee, section, commission, (·−−· −−− ·−·· −·−− ·−−· ···· −−− −· ·· · ··· for the transdimensionals)&hellip;</p>
<blockquote>
<p>
<a href="https://michee.io/en-us/posts/what-is-a-commu-groups-and-roles/">What is a community? Groups and roles</a></p></blockquote>
<p>There you go. Of course, this is a base. There are many variants and special cases.</p>]]></content:encoded>
    </item>
    <item>
      <title>What is a commu ? Groups and roles</title>
      <link>https://michee.io/en-us/posts/what-is-a-commu-groups-and-roles/</link>
      <pubDate>Wed, 29 Oct 2025 16:00:00 +0000</pubDate>
      <guid>https://michee.io/en-us/posts/what-is-a-commu-groups-and-roles/</guid>
      <description>How can you properly manage what you can do on the service compared to what other users can (or cannot) do on the same service?</description>
      <content:encoded><![CDATA[<p>Once connected to a service, you’re not necessarily the only user at that moment.
How can you properly manage what you can do on the service versus what other users can (or cannot) do?</p>
<p>Note: This post was translated from french with the help of AI. The original post was written with the knowledge of a younger me.</p>
<p>The service implements access control. Most commonly, it uses group-based or role-based access control.
For a social network, there is also relationship-based access control.</p>
<h2 id="group-based-access-control">Group-Based Access Control</h2>
<p>This is the tribe.</p>
<p>This type of access control is a grouping of users who have access to a certain set of resources.</p>
<p>This grouping defines permissions (rights) for using these resources. Each user in this group inherits those permissions.</p>
<h2 id="role-based-access-control">Role-Based Access Control</h2>
<p>This is the tribal chief or shaman…</p>
<p>This type of access control defines a set of permissions (rights) that are collectively assigned to a specific user.</p>
<p>Typically, there’s an Administrator role that has all permissions. Other roles are granted to users by this Administrator.
A user cannot assign a role to themselves.</p>
<p>Roles can also be hierarchical. A higher-level role includes all permissions of a lower-level role plus additional ones.</p>
<h2 id="difference-and-relationship-between-the-two">Difference and Relationship Between the Two</h2>
<p>When comparing these two types of access control, it can be tricky to distinguish them.
Depending on the system, the distinction may not even be explicitly made.</p>
<p>To clarify, here is the distinction:</p>
<ul>
<li>Groups are generally used to classify resources and users. They manage identity. For example: a user belongs to one or more groups.</li>
<li>Roles are generally used to manage permissions and rights. They manage activity. For example: a user can perform a certain action because they have a specific role.</li>
</ul>
<p>Groups and roles are linked because they complement each other:
A group defines the scope of a role. That is, the users and resources on which the role can act.
But a role can exist across multiple groups.</p>
<h3 id="example-facebook">Example: Facebook</h3>
<p>You might be a member of the &ldquo;<em>Raspberry Fans Group</em>&rdquo; and like the &ldquo;<em>Blackberry Fans Page</em>.&rdquo;
From an access control perspective, you belong to two groups.</p>
<p>Within the &ldquo;<em>Raspberry Fans Group</em>&rdquo; you’re a member, and within the &ldquo;<em>Blackberry Fans Page</em>&rdquo; you’re a moderator. These are your roles.</p>
<p>As you can see, your roles are bounded by groups. You are a moderator of the &ldquo;<em>Blackberry Fans Page</em>&rdquo; only, not elsewhere.
But there might be a moderator of the &ldquo;<em>Raspberry Fans Group</em>&rdquo; who has the same permissions there as you have on the page.
Thus, a role can be present in multiple groups.</p>
<p>Also, group membership provides default permissions.
As a regular member of the &ldquo;<em>Raspberry Fans Group</em>&rdquo;, you have access to that group’s posts. You wouldn’t have this access if you weren’t a member.</p>
<h3 id="example-a-computer">Example: A Computer</h3>
<p>The distinction between group and role is subtle (especially on UNIX).
But you can think of the computer itself as the group, and the user accounts on that computer have roles (usually one is the administrator—a role that exists on all computers).</p>
<h2 id="relationship-based-access-control">Relationship-Based Access Control</h2>
<p>This refers to your friends or contacts on social networks.</p>
<p>The existence of a relationship between you and a friend grants permissions to both of you over each other’s resources.</p>
<p>The relationship manages permissions.
These can be symmetric (the friend has the same rights as you) or asymmetric (the friend has fewer permissions—this is closer to a “fan” or hierarchical relationship).</p>
<h2 id="capability-based-access-control">Capability-Based Access Control</h2>
<p>This type of access control allows for fine-grained permission management.</p>
<p>Permissions are attached to a specific resource (object) rather than a group of resources (as in group- or role-based control).
The object-permission pair forms a capability.</p>
<p>If a user possesses the corresponding capability, they can access that object with the defined permissions.</p>
<p>This allows for much more precise permission management since it’s handled resource by resource.</p>
<p>This control type is used by 
<a href="https://michee.io/en-us/posts/social-logins-how-do-they-work">OAuth2</a> (the mechanism used for social login) to manage permissions.
For example, when you use Facebook social login on a website, Facebook tells you that the site wants to access your email, your friends list, or other data.</p>
<p>This is the capability you delegate (fully or partially) to the site over the Facebook resource (which in this case is your profile).</p>]]></content:encoded>
    </item>
    <item>
      <title>Social logins: how do they work?</title>
      <link>https://michee.io/en-us/posts/social-logins-how-do-they-work/</link>
      <pubDate>Wed, 22 Oct 2025 16:00:00 +0000</pubDate>
      <guid>https://michee.io/en-us/posts/social-logins-how-do-they-work/</guid>
      <description>Facebook, Google, and others allow you to authenticate on different websites through them. How does it work, and what are the risks?</description>
      <content:encoded><![CDATA[<h2 id="how-does-it-work">How does it work?</h2>
<p>The underlying protocol that everything relies on is OAuth2. So, let&rsquo;s start there.</p>
<p>Note: This post was translated from french with the help of AI. The original post was written with the knowledge of a younger me.</p>
<h3 id="oauth2">OAuth2</h3>
<p>If there&rsquo;s a “2”, that means it&rsquo;s the second version.</p>
<p>The first version, OAuth, had multiple security vulnerabilities. <strong>Never use it.</strong></p>
<p>OAuth2 is the protocol that manages authorization. It allows a device to access resources—data stored on a server.</p>
<p>To do this, it uses <em>scopes</em>. These are parameters that request access to specific resources.</p>
<p>For example, the <em>scope</em> “profile” requests access to the user’s profile information.</p>
<p>The server returns a <em>claim</em>, which represents the requested data.</p>
<p>For the “profile” scope, the <em>claim</em> would be:</p>
<pre><code class="language-json">{
  &quot;name&quot;: &quot;Alice the rabbit&quot;,
  &quot;firstname&quot;: &quot;Alice&quot;,
  &quot;lastname&quot;: &quot;the rabbit&quot;
}
</code></pre>
<p>This protocol can handle different methods of granting authorization, but for social login, only one concerns us.</p>
<h3 id="authorization-code-grant">Authorization Code Grant</h3>
<p>This authentication method allows a service to authorize a user’s login without requiring their password, by trusting an authorization server.</p>
<p>Here’s how it works:</p>
<ul>
<li>The user wants to log in to a service</li>
<li>The service redirects the user to the authorization server’s login page</li>
<li>The user logs into the authorization server if not already logged in (they enter their password at this step on the authorization server)</li>
<li>The authorization server displays a confirmation panel asking the user if they really want to connect to the service</li>
<li>The user confirms</li>
<li>The server then redirects the user back to the service with an authorization code</li>
<li>The service uses the received authorization code to request an access token from the authorization server</li>
<li>The authorization server approves the connection between the service and the user</li>
<li>The user is logged in to the service</li>
</ul>
<p>As you can see, the user never enters their password on the service. Password storage happens only on the authorization server.</p>
<h2 id="openid-connect">OpenID Connect</h2>
<p>This extension of OAuth2 is managed by the OpenID Foundation, which also maintains the original OpenID with its own mechanism.</p>
<p>This extension handles authentication (identity). It leverages the authorization server as an authentication server.</p>
<p>Building on the “Authorization Code Grant” flow,
it verifies the user’s identity with the server using information returned by it (a unique identifier, usually an email, though ideally a UUID).</p>
<p>Additionally, this extension offers several options:</p>
<ul>
<li>The UserInfo endpoint provided by the authentication server: allows dynamic retrieval of user profile information</li>
<li>The Session endpoint provided by the authentication server: enables session verification to synchronize sessions
(e.g., making sure the user’s session on the service ends when they log out of the server)</li>
<li>A logout flow that logs the user out of all services when they log out of the authentication server</li>
<li>An implicit login flow called “Single Sign-On” which allows users to log into a service seamlessly.
The service and the server appear unified as a single application.</li>
</ul>
<h3 id="advantages">Advantages</h3>
<p>This system links multiple services without requiring a password for each one, enhancing security.</p>
<p>It also enables data synchronization between services with a central information silo (a reference point for data storage).
This reduces data conflicts when properly implemented.</p>
<h3 id="risks">Risks</h3>
<p>Using this system requires full trust in the authorization provider.
The provider can access information within connected services because it can impersonate the user and obtain an authorization code on their behalf.</p>
<p>Identity and data synchronization isn’t always well executed.
You might end up with multiple accounts on the same service just because you changed your email on the authorization server.
The service relying on email won’t recognize the old account and will create a new one.</p>
<p>Logout is often not implemented.
Major social login providers use persistent sessions, and many services don’t implement proper logout checks.
As a result, services may remain logged in (the user stays connected) even after logging out of Facebook or Google.</p>
<p>If the authorization server is attacked, compromised, or weakened, all linked services become vulnerable.</p>
<h3 id="attacks">Attacks</h3>
<h4 id="clickjacking">Clickjacking</h4>
<p>A hacker could create a malicious service that loads the authorization server inside a transparent <em>iframe</em>.</p>
<p>To simplify, imagine your authentication server as a smartphone.</p>
<p>You tap the center button on your smartphone screen to accept the service.</p>
<p>With clickjacking, the hacker has placed a transparent sheet over your screen,
and when you click the button, you’re actually clicking on the sheet, unknowingly granting the malicious service access to your data.</p>
<p>For developers: Implement the <code>X-Frame-Options</code> header with strict settings (e.g., “SameOrigin”) and/or use JavaScript framebusting techniques.</p>
<h4 id="cross-site-request-forgery-csrf">Cross-Site Request Forgery (CSRF)</h4>
<p>A hacker can trick the user into clicking an authorization button that redirects,
not to the intended service, but to the hacker’s malicious service.
The malicious service captures the authorization code and then redirects the user to the correct service.</p>
<p>The user notices nothing, but the malicious service now has the authorization and access tokens.</p>
<p>For developers: Enforce fixed, pre-registered redirect URLs for services.</p>
<p>There are other CSRF variations; I’ll detail them in a future article.</p>
<h4 id="confused-deputy-problem">Confused Deputy Problem</h4>
<p>This issue occurs when services do not correctly verify the identity of the user utilizing the authorization server.</p>
<p>A malicious user can log in to the authorization server and trick the service into thinking they are another user
by manipulating the information used to identify the user.</p>
<p>If the service doesn’t use a reliable identifier for proper user identification,
it gets fooled and grants access to the wrong account.</p>
<p>Example:</p>
<p>A service uses an authorization server that provides both a UUID and a username.</p>
<p>The authorization server has two accounts:</p>
<ul>
<li>Alice with UUID: <code>46d07175-dbf2-46e2-80fc-c6493e481479</code></li>
<li>Oscar with UUID: <code>362b862b-51b3-41f4-82c7-82eb677a9aa4</code></li>
</ul>
<p>The authorization server provides UUIDs as unique identifiers, expecting the service to use them.</p>
<p>But instead, the service chooses to use the username as the unique identifier.</p>
<p>Oscar changes his username to “Alice” (allowed by the server since it uses UUID as the true unique ID).</p>
<p>Now, when Oscar logs into the service, he gains access to Alice’s account
(because the service mistakenly uses username as the unique identifier).</p>
<p>For developers: Always choose a truly unique identifier. UUIDs are designed for this purpose.
They don’t carry user information and allow users to freely change their details (even email) without affecting uniqueness.</p>]]></content:encoded>
    </item>
    <item>
      <title>All About Two-Factor Authentication</title>
      <link>https://michee.io/en-us/posts/all-about-two-factor-authentication/</link>
      <pubDate>Wed, 15 Oct 2025 16:00:00 +0000</pubDate>
      <guid>https://michee.io/en-us/posts/all-about-two-factor-authentication/</guid>
      <description>Two-factor authentication strengthens authentication by adding an extra step. But more specifically, what is it?</description>
      <content:encoded><![CDATA[<h2 id="the-principle">The Principle</h2>
<p>The idea behind two-factor authentication is to ensure that the user identifies themselves using two techniques that are very unlikely to be compromised at the same time.</p>
<p>The key phrase to remember is:</p>
<p>&ldquo;Something you know, something you have.&rdquo;</p>
<p>Note: This post was translated from french with the help of AI. The original post was written with the knowledge of a younger me.</p>
<p>In practice, this often involves a password (“something you know”) and a physical device (e.g., a message on a smartphone, “something you have”).</p>
<p>Two-factor authentication is just one method within a broader concept: multi-factor authentication.</p>
<h2 id="multi-factor-authentication">Multi-Factor Authentication</h2>
<p>When you watch a spy movie with a secret base, you sometimes see the hero or villain scan their iris, type a code on a keyboard, place their hand on a pad, and even spit into a sensor before opening the door.
That’s multi-factor authentication.</p>
<p>You may encounter or implement an authentication chain, meaning several authentication steps are required, and if one fails, authentication stops.</p>
<p>In some real-world high-security scenarios, more than two steps are used.
But most of the time, two steps are enough.</p>
<h2 id="methods-and-their-pitfalls">Methods (and Their Pitfalls)</h2>
<h3 id="sms">SMS</h3>
<p>The most common two-factor authentication method is SMS.</p>
<p>This is the weakest method because it’s easily hackable.
With enough resources, a hacker can compromise SS7.</p>
<p>SS7 is the network layer that routes SMS messages. Designed in the 1970s, it’s long outdated and has been exploited in real attacks (
<a href="https://www.nextinpact.com/news/104214-ss7-apres-interceptions-sms-securite-reseaux-mobiles-en-question.htm" target="_blank">NextImpact article in french</a>).</p>
<p>It’s also inconvenient in areas with no mobile network coverage.</p>
<h3 id="push">PUSH</h3>
<p>Another method used by some services is push authentication.
This involves a notification sent to your smartphone asking for your approval.
The message is <em>pushed</em> by the service to your device.</p>
<p>This requires an internet connection on your phone, which can be a weakness because hackers can attempt to intercept these notifications.</p>
<h3 id="hotptotp">HOTP/TOTP</h3>
<p>The second most common method is HOTP/TOTP (HMAC-based One-Time Password / Time-based One-Time Password).</p>
<ul>
<li>HOTP (“One-time password based on HMAC”) generates a unique password using a cryptographic HMAC and a counter.</li>
<li>The user installs an app on their smartphone that generates a 6-character token on demand.
This token is generated using:
<ul>
<li>A seed stored both in the web service account and the app.</li>
<li>A counter that increments in sync between the service and the app.</li>
</ul>
</li>
</ul>
<p>When the user enters the token, the web service compares it with its own calculation.
If they match, authentication succeeds.
The service knows it’s from the user’s smartphone because only that device holds the seed.</p>
<p>The seed is usually transferred from the service to the user via a QR code.</p>
<ul>
<li>TOTP (“Time-based One-time Password”) extends HOTP by using the current time (typically 30-second intervals) instead of a counter.
TOTP is much more widely used than HOTP.</li>
</ul>
<p>We recommend using FreeOTP to generate tokens on smartphones or other devices:</p>
<ul>
<li>
<a href="https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp" target="_blank">Android</a> and 
<a href="https://f-droid.org/en/packages/org.fedorahosted.freeotp/" target="_blank">F-droid</a></li>
<li>
<a href="https://itunes.apple.com/us/app/freeotp-authenticator/id872559395?mt=8" target="_blank">iOS</a></li>
<li>
<a href="https://github.com/freeotp" target="_blank">Source Code</a></li>
</ul>
<p>These methods do not require internet or SMS connectivity, making them safer. Hackers can’t intercept messages because no messages are sent.</p>
<h3 id="hardware-devices">Hardware Devices</h3>
<p>The most secure method is to use a dedicated hardware device.
During setup, the device is linked to your account on the web service.
Thanks to cryptographic recognition (the device contains an asymmetric key),
the service recognizes it as “something you have” for authentication.</p>
<p>The downside: you have to carry an extra device—and not lose it!</p>
<p>Some banks also provide hardware tokens tied to your bank card, often using TOTP internally.</p>
<h3 id="recovery-codes">Recovery Codes</h3>
<p>While not strictly “something you have,” recovery codes are the best backup method if you lose your device or smartphone.
It’s a list of single-use tokens you can use instead of your primary factor.</p>
<p>Store this list in a very secure location and only use it as a last resort.</p>
<h2 id="attacks">Attacks</h2>
<p>These solutions aren’t perfect and can be targeted by attackers.</p>
<h3 id="social-engineering">Social Engineering</h3>
<p>In SMS-based two-factor authentication, attackers can use social engineering.
For example, 
<a href="https://www.youtube.com/watch?v=kHI90LbBwaQ" target="_blank">DeRay McKesson’s case</a>.</p>
<p>Hackers impersonate the phone owner with the carrier, request a SIM card swap,
and once their SIM is activated, they receive all of the victim’s SMS messages.</p>
<h3 id="proxy-attacks">Proxy Attacks</h3>
<p>Attackers can also intercept via proxies, either by:</p>
<ul>
<li>Creating a fake mobile network nearby to intercept SMS (
<a href="https://www.nextinpact.com/news/104214-ss7-apres-interceptions-sms-securite-reseaux-mobiles-en-question.htm" target="_blank">NextImpact article in french</a>), or</li>
<li>Setting up a phishing site that mimics the real one to capture credentials and tokens.
This is known as a homograph attack or typosquatting.</li>
</ul>
<p>Mitigation:
Use hardware authentication or always check the website domain name.</p>
<p>Example:
If you intend to visit &ldquo;douce-framboise.com&rdquo;, make sure it’s not &ldquo;douce-framb0ise.com&rdquo;.</p>
<h3 id="forgotten-authentication-paths">Forgotten Authentication Paths</h3>
<p>Sometimes web service maintainers forget that the main login page isn’t the only access point.</p>
<p>Examples:</p>
<ul>
<li>Password reset via an email link may bypass two-factor authentication.</li>
<li>Using external services via APIs (like Google or Facebook OAuth2 login) might also skip two-factor checks.</li>
</ul>
<p>Always ensure two-factor authentication is enforced for all access paths to your users’ data.</p>]]></content:encoded>
    </item>
    <item>
      <title>All About a Good Password</title>
      <link>https://michee.io/en-us/posts/all-about-a-good-password/</link>
      <pubDate>Wed, 01 Oct 2025 16:00:00 +0000</pubDate>
      <guid>https://michee.io/en-us/posts/all-about-a-good-password/</guid>
      <description>Many articles on the web try to explain how to create a good password. Unfortunately, they often contain many misconceptions.</description>
      <content:encoded><![CDATA[<p>We’ll try here to gather the correct information for properly managing passwords.</p>
<p>Note: This post was translated from french with the help of AI. The original post was written with the knowledge of a younger me.</p>
<h2 id="the-password-to-rule-them-all">The password to rule them all</h2>
<p>First of all, how can you create a good password you can remember?</p>
<h3 id="replacing-characters-is-not-good">Replacing characters is not good</h3>
<p>Often, a bad but seemingly good idea pops up: replacing characters with others.</p>
<p>For example, using “p@ssw0rd” instead of “password”.</p>
<p>This idea comes from the English-speaking world and is based on the fact that most passwords were composed of ASCII characters,
meaning the 26 letters of the Latin alphabet plus some punctuation symbols.</p>
<p>This article was originally written in French and was therefore aimed at French speakers who are less affected by this issue because French contains characters
not included in the basic ASCII table. Accents, for example: “à, é, è, ù&hellip;” are included in the extended ASCII table
or even UTF-8 (a table that contains alphabets from all over the world: Arabic, Cyrillic, Chinese&hellip;).</p>
<p>This technique makes passwords much harder to remember.
Because they’re hard to memorize, we tend to make them shorter, which is also very bad.</p>
<h3 id="passphrases-are-good">Passphrases are good</h3>
<p>This technique is known thanks to the 
<a href="https://xkcd.com/936/" target="_blank">xkcd</a> comic strip, often referred to as “correct horse battery staple”.</p>
<p>To be effective, the combination of words must be as rare as possible. In the xkcd comic, this rarity is conveyed by randomness.</p>
<p>But let’s not forget that this is a password we need to remember. Our brains don’t handle randomness well.
That’s why, at the end of the comic, the author emphasizes creating a mental image of the passphrase.</p>
<p>Note: In French, word frequency and word combinations are lower than in English because French speakers are fewer
and the language contains articles, determiners, and possessives that further reduce combination probability.
Thus, randomness is less critical than in English.</p>
<p>We can therefore use grammatically correct phrases as passwords.</p>
<h3 id="an-example-to-illustrate">An example to illustrate:</h3>
<p>Which do you think is the better password:</p>
<p>“!He_r@spberr1es”</p>
<p>or</p>
<p>“The Queen of the Night’s Aria, The Magic Flute by Wolfgang Amadeus Mozart”</p>
<p>If you like Mozart, it’s definitely the second one.
It’s easy to remember, longer than the first, and the chance that two people have the same password is low.</p>
<h2 id="the-password-manager-to-bring-them-all">The password manager to bring them all</h2>
<p>Having a password you can remember is good.
But even better is being able to use passwords you cannot remember yourself.
This reduces the risk of accidentally revealing them in conversation.</p>
<p>Jimmy Kimmel has a segment on his show 
<a href="https://www.youtube.com/watch?v=opRMrEfAIiI" target="_blank">available on YouTube</a>.</p>
<p>To avoid this risk and create passwords you can’t remember, you need a password manager.</p>
<p>This is software or a web service that stores your passwords and displays them when requested.
You just copy-paste them or use plugins that auto-fill login forms.
They’re usually encrypted, and you access them with a master password. The only one you really need to remember.</p>
<p>With this system, since you don’t have to remember passwords, go big.
Use 50-character randomly generated passwords with lots of weird symbols.
Take advantage of UTF-8, checking compatibility with your software and services (not all support it,
and some don’t display Cyrillic correctly, for example).</p>
<h3 id="software-or-web-service">Software or web service</h3>
<p>The advantage of using software instead of a web service is reduced risk of attacks and leaks.</p>
<p>A web-based password manager attracts attackers
because a breach could expose thousands of accounts instead of just one.</p>
<p>There are also legal conflicts between the service’s jurisdiction and users’ rights,
for example, European GDPR vs. the U.S. Cloud Act.
We’ll discuss these legal aspects in future articles.</p>
<p>The advantage of a web service is a lower risk of password loss and a dedicated team monitoring and patching vulnerabilities.</p>
<h3 id="me">Me</h3>
<p>I use 
<a href="https://keepassxc.org/" target="_blank">KeepassXC</a>.</p>
<p>It’s open-source, meaning the code can be easily audited.</p>
<p>It runs locally on your devices instead of online, reducing centralized attack surfaces.</p>
<p>It encrypts passwords with the master password.</p>
<p>Legal conflicts between European GDPR and the U.S. Cloud Act are avoided
since passwords aren’t stored on U.S. servers.</p>
<p>However, it’s harder to share the password database across devices.
You also need to manage backups of your encrypted password database yourself.</p>
<p>KeepassXC is a variant of 
<a href="https://www.keepassx.org/" target="_blank">KeepassX</a>
(development appears to have stopped), itself a variant of 
<a href="https://keepass.info/" target="_blank">Keepass</a>,
which is Windows-only. In fact, Keepass will undergo a security audit by the European Commission.</p>
<h2 id="and-in-the-darkness-bind-them-attacks">And in the darkness bind them (attacks)</h2>
<h3 id="mass-attacks">Mass attacks</h3>
<p>Mass attacks aim to collect as many passwords as possible,
without caring whose accounts they belong to.</p>
<h3 id="dictionary-attacks">Dictionary attacks</h3>
<p>The most common are dictionary attacks.
They require little computing power but lots of storage (time-memory tradeoff).
They test the most common known passwords (from previous breaches) and move on if they fail.</p>
<p>A yearly list of the 
<a href="https://gizmodo.com/the-25-most-popular-passwords-of-2018-will-make-you-fee-1831052705" target="_blank">25 most popular passwords</a> is published
(here’s the 2018 list, with 2017 comparison):</p>
<ul>
<li>123456 (unchanged)</li>
<li>password (unchanged)</li>
<li>123456789 (+3 spots)</li>
<li>12345678 (-1)</li>
<li>12345 (unchanged)</li>
<li>111111 (new)</li>
<li>1234567 (+1)</li>
<li>sunshine (new)</li>
<li>qwerty (-5)</li>
<li>iloveyou (unchanged)</li>
<li>princess (new)</li>
<li>admin (-1)</li>
<li>welcome (-1)</li>
<li>666666 (new)</li>
<li>abc123 (unchanged)</li>
<li>football (-7)</li>
<li>123123 (unchanged)</li>
<li>monkey (-5)</li>
<li>654321 (new)</li>
<li>!@#$%^&amp;* (new)</li>
<li>charlie (new)</li>
<li>aa123456 (new)</li>
<li>donald (new)</li>
<li>password1 (new)</li>
<li>qwerty123 (new)</li>
</ul>
<p>The issue with this list, present in all “how to make a good password” articles,
is that it’s from the English-speaking world and doesn’t reflect the most common passwords in other languages (as french).
If you have sources for other languages passwords, I’d love to see them.</p>
<p>Of course, there are also lists with 100, 1,000, 10,000, 1 million, or more passwords circulating online.</p>
<h3 id="rainbow-tables">Rainbow tables</h3>
<p>The second type is the rainbow table attack.
It’s more computationally expensive but requires less storage.
It only works if the attacker has obtained a database of password hashes
(we’ll explain “hash” in a future article).</p>
<p>A rainbow table compares its stored hashes with those in the hacked database.
If they match, the password is the same.</p>
<p>Example:</p>
<p>The attacker has a rainbow table with these md5 hashes:</p>
<ul>
<li>password: 5f4dcc3b5aa765d61d8327deb882cf99</li>
<li>sdhfksdkfh: e2a1dbf388e7a7e87dc02943e3521036</li>
<li>raspberry: 54a9fc48a5b664772e2ca06d1e0772d9</li>
</ul>
<p>They hack a site’s hash table and get:</p>
<ul>
<li>Bob: 098f6bcd4621d373cade4e832627b4f6</li>
<li>Alice: 54a9fc48a5b664772e2ca06d1e0772d9</li>
<li>Lee: 190a16e29799b184d9900690ee04438a</li>
</ul>
<p>The second hash matches the third entry in their rainbow table,
so Alice’s password is “raspberry”.</p>
<p>Passphrases counter both these attacks.
If the passphrase isn’t in the dictionary or rainbow table, the attack fails.</p>
<p>In a future article, we’ll discuss strengthening hash tables for website developers.</p>
<p>In the hash article, we’ll also see how to reduce rainbow table storage needs.</p>
<h3 id="brute-force-grrrr">Brute force (grrrr)</h3>
<p>The last technique is brute force: trying every possible combination.
It’s the most computationally expensive but requires the least storage.</p>
<p>It’s the oldest method and why we started adding special characters to passwords.</p>
<p>But attackers have long used extended ASCII (with uppercase and accents)
or UTF-8 (all alphabets worldwide: Arabic, Cyrillic, Chinese&hellip;) to test everything.</p>
<p>To counter it, use longer passphrases and the full alphabet (not “aaaaaaaaaaaaaaaaaaaaaa”).</p>
<p>This increases entropy (we’ll explain entropy in another article).
French, with its accented letters, provides even higher entropy than English.</p>
<p>Example:</p>
<p>“!Es_fr@mbo1ses” has 72.1 bits of entropy, which is strong (good for most cases).</p>
<p>“The Queen of the Night’s Aria, The Magic Flute by Wolfgang Amadeus Mozart”
has 475.8 bits of entropy, making it ultra-strong (obviously good).</p>
<p>The higher the entropy, the longer brute-force takes.
The goal is to make attacks take years or centuries, not seconds.
And with a password manager, take full advantage of UTF-8 (checking compatibility).</p>
<h3 id="targeted-attack">Targeted attack</h3>
<p>A targeted attack aims to hack a specific user.</p>
<h4 id="keylogger">Keylogger</h4>
<p>This involves infecting the user’s device with a tool that records every keystroke.
When the user types their password, it’s captured.</p>
<p>This is outside this article’s scope and will be covered in future articles.</p>
<h4 id="social-engineering">Social engineering</h4>
<p>Through social engineering, a hacker may obtain your password
from friends, family, or even you.
Remember 
<a href="https://www.youtube.com/watch?v=UzvPP6_LRHc" target="_blank">Jimmy Kimmel</a>.</p>
<p>First, never share your password with anyone.
Many services (including email) allow account sharing without sharing passwords.</p>
<p>Second, a password manager helps here too.
If you don’t know your own password, a hacker can’t extract it this way.</p>
<p>For your master password, try a unique word combination or phrase no one knows.</p>
<h2 id="tools-to-find-them">Tools to find them</h2>
<p>Yes, for those catching the title reference, I had to swap titles for coherence.</p>
<p>Once you have passwords for online services or devices, you must monitor them and track their lifecycle.</p>
<p>Make sure deleted passwords are truly deleted.</p>
<h3 id="expiration">Expiration</h3>
<p>You can set an expiration date for passwords.
I don’t recommend this unless you’re sure because it often clashes with human behavior.</p>
<p>People quickly create slightly modified versions of old passwords
or stop changing them altogether.
Since password expiration handling isn’t standardized, this can create security flaws.</p>
<h3 id="breach-monitoring">Breach monitoring</h3>
<p>You should also ensure your password hasn’t been breached.
Use monitoring tools for this.</p>
<p>A great service is 
<a href="https://haveibeenpwned.com/" target="_blank">haveibeenpwned</a> by Troy Hunt.
You can monitor your emails, and if they appear in a breach, the service notifies you.</p>
<p>It even provides tools to integrate into your website or app.
However, I have serious GDPR concerns about it (to be discussed later).</p>
<p>Lastly, here’s a Twitter account showing
how hard it is for services to handle passwords correctly:</p>
<p>
<a href="https://twitter.com/PWTooStrong" target="_blank">https://twitter.com/PWTooStrong</a></p>
<p>Well, I’ve promised a lot of future articles. Great, more work for me. Pfff&hellip;</p>
<p>For developers, here are some tips on 
<a href="https://michee.io/en-us/posts/implementations-of-the-passphrase/">implementing passwords</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Implementations of the passphrase</title>
      <link>https://michee.io/en-us/posts/implementations-of-the-passphrase/</link>
      <pubDate>Wed, 01 Oct 2025 16:00:00 +0000</pubDate>
      <guid>https://michee.io/en-us/posts/implementations-of-the-passphrase/</guid>
      <description>Do you manage a web service, a website, or software and want to implement password management for your user sessions?</description>
      <content:encoded><![CDATA[<p>First, read this article on 
<a href="https://michee.io/en-us/posts/all-about-a-good-password/">what makes a good password</a>, then continue reading this one.</p>
<p>Note: This post was translated from french with the help of AI. The original post was written with the knowledge of a younger me.</p>
<h2 id="password-rules">Password Rules</h2>
<p>If you’re tempted to set password rules like “between 8 and 20 characters” or “3 uppercase letters,” stop right there.</p>
<p>This approach is outdated, overly rigid for users, and leads them to create passwords that are hard for them to remember but very easy for bots to crack.</p>
<p>Don’t believe me? Check out the Twitter account 
<a href="https://twitter.com/PWTooStrong" target="_blank">passwordistoostrong</a>.</p>
<p>Example:</p>
<p>Imagine the rule:</p>
<p>“Between 8 and 20 characters, at least 3 uppercase letters, and a punctuation mark.”</p>
<p>This password would qualify: “AbCdEfgh!” even though it’s not actually strong.</p>
<p>Meanwhile, the user is left frustrated.</p>
<h2 id="entropy">Entropy</h2>
<p>Instead, use an entropy-based system.</p>
<p>The 
<a href="https://github.com/dropbox/zxcvbn" target="_blank">zxcvbn</a> library (named after the bottom row of keys on a U.S. keyboard) is a great implementation for calculating password strength based on entropy.
It’s available in a wide variety of programming languages.</p>
<p>The advantage is that there are no rigid rules for estimating password strength.
The library calculates the complexity of your password (considering the rarity of characters, their patterns, etc.) and assigns it a score.
You can then decide from which score threshold you consider the password sufficiently secure.</p>
<p>Of course, you must use the same scoring and thresholds on both the server and client sides.
If they differ, the server has the final say since the client side can be tampered with by an attacker (it’s not secure).</p>
<h2 id="avoid-compromised-passwords">Avoid Compromised Passwords</h2>
<p>Once you’ve set a threshold to block weak passwords, you still need to check if the entered password hasn’t already been compromised.</p>
<p>This is an optional additional safeguard because if your complexity threshold is high enough, the way the password is stored can already effectively defend against rainbow table attacks. Still, it’s a valuable bonus.</p>
<p>To do this, you can either load a JavaScript file on the client side or make an AJAX request to an API when the user creates their password.</p>
<p>If your AJAX request sends the plaintext password, that’s a problem. It increases your attack surface.</p>
<p>Loading a JavaScript file can be heavy, so it’s better to load it asynchronously. However, even asynchronously, the file size (and therefore the number of compromised passwords it can check) is limited.</p>
<p>Naturally, since the client side is not secure, you must repeat the verification on the server side.</p>
<p>Another technique is to use the 
<a href="https://haveibeenpwned.com/" target="_blank">Have I Been Pwned</a> service.
It offers a technically elegant solution but, as it’s an Australian service using U.S.-based infrastructure,
it raises serious concerns about GDPR compliance in Europe (we’ll cover this in a future article).</p>
<p>This service works using k-anonymity.</p>
<p>You hash the user’s password and send only the first k characters of the hash to the service.
The service returns all hashes in its database that share those k starting characters.
You then compare them to the user’s password hash; if any matches, the password has been compromised.</p>
<p>Example:</p>
<p>The password “framboise” has this SHA256 hash:</p>
<p>“F9E4141EE43A3B877758E2584A1F6A0E7A9C8D6E58BB859A1665D8C1F447003C”</p>
<p>The first 5 characters are “F9E41.”</p>
<p>You send those 5 characters to 
<a href="https://haveibeenpwned.com/" target="_blank">Have I Been Pwned</a>.</p>
<p>It returns:</p>
<ul>
<li>“F9E4141EE43A3B8777ERT8584A1F6A0E7A9C8D6E58BB859A1665D8C1F447003C”</li>
<li>“F9E4141EE962758777ERT8584A1F6A0E7A9C8D6E58BB859A1665D8C1F447003C”</li>
<li>“F9E4141EE43A3B877758E2584A1F6A0E7A9C8D6E58BB859A1665D8C1F447003C”</li>
</ul>
<p>You compare and see that the third hash matches the user’s hash.
Therefore, the password is compromised.</p>
<p>With this system, no password is ever transmitted over the network, and 
<a href="https://haveibeenpwned.com/" target="_blank">Have I Been Pwned</a> never knows which password you’re testing.
In the example, three results were returned, but the smaller the k value, the more results you get.</p>
<h2 id="then-store-passwords-properly">Then Store Passwords Properly</h2>
<p>After the user has chosen a good password and securely submitted it, you must store it properly.</p>
<p>A fundamental rule: <strong>never store passwords in plain text.</strong>
If an attacker gains access to your password storage, you’ve handed them access to every account on your service, and possibly other services (users unfortunately often reuse passwords).</p>
<p>So, what should you do?</p>
<ol>
<li>
<p>First, limit password length, but not too much.
Drupal, for example, limits password length to 512 bytes, meaning between 128 and 512 UTF-8 characters.
This step is necessary to prevent a DoS attack because hashing consumes resources (an attacker could input an extremely long password to exhaust system resources during hashing).</p>
</li>
<li>
<p>Generate a random salt. A specific length string.

   <figure class="figure text-center">
     <img src="https://michee.io/en-us/posts/implementations-of-the-passphrase/images/table-salt.jpg" class="figure-img img-fluid rounded" alt="Table salt also called pepper">
     <figcaption class="figure-caption"><p>Table salt</p>
       <small>Table salt also called pepper</small>
     </figcaption>
   </figure>

You can generate a salt per database (for all passwords) or per password.
It’s added to the password to ensure identical passwords have different hashes.
Salts prevent hash comparisons, table-wide or row-wide, even if users choose the same password or reuse it across services.</p>
<p>Example:</p>
<p><strong>Table-level salt:</strong></p>
<p>Alice uses “framboise” on both “nice-raspberries-squashed.com” and “mean-raspberries-squashed.com”.</p>
<p>“nice-raspberries-squashed.com” generates salt “458,” making Alice’s password “458framboise.”</p>
<p>“mean-raspberries-squashed.com” generates salt “gdf,” making Alice’s password “gdfframboise.”</p>
<p>If a hacker accesses both tables, the hashes won’t match (since the salted passwords differ), so they won’t know Alice reused the same password.</p>
<p><strong>Row-level salt:</strong></p>
<p>Alice and Bob both use “framboise” on “nice-raspberries-squashed.com.”</p>
<p>The site generates salt “458” for Alice’s password → “458framboise.”</p>
<p>It generates salt “sdd” for Bob’s password → “sddframboise.”</p>
<p>If an attacker accesses the table, they won’t know Alice and Bob used the same password because their hashes are different.</p>
</li>
<li>
<p>Hash the combined salt + password using a secure algorithm like SHA512.</p>
<p>For password “framboise” with salt “458”:</p>
<p>hash(sha256, ‘458framboise’) = ‘527D88733ED03CE5EF2D12AE4279950ABC29DC42817B14A58AB2150678A7CC72486CE637B8AD10333E80879F3D0CE685FA6CBB5DB8D7954382C2116616F8F6CF’</p>
</li>
<li>
<p>You now have a reasonably secure stored password. Also store the salt.
To strengthen the hash further, you can iterate hashing with the previous hash and the password:</p>
<p>hash(sha256, ‘527D88733ED03CE5EF2D12AE4279950ABC29DC42817B14A58AB2150678A7CC72486CE637B8AD10333E80879F3D0CE685FA6CBB5DB8D7954382C2116616F8F6CF framboise’) = ‘E3A252D3C455D638C82D8430DDC85E9B5B13F6508D690D97E2C5A1CC8AEE4A26D4C723E4EE4F524B4926C0357B2651132DF67446721BB4D3BCDD017C4A0E0E1B’</p>
<p>The goal is to make the resulting hash different from any known hashes attackers might have, making password recovery harder.</p>
<p>When a user tries to log in again, your system repeats the process (using the stored salt) and compares the new hash to the stored one. If they match, the password is correct.</p>
</li>
</ol>
<h2 id="common-mistakes-to-avoid">Common Mistakes to Avoid</h2>
<p>Sometimes we make silly mistakes! Here are some to avoid:</p>
<ul>
<li>
<p>When changing the complexity threshold for accepted passwords, <strong>don’t</strong> apply it to old password fields.
Otherwise, users won’t be able to enter their old password to change it. Only apply the threshold to new password fields.</p>
</li>
<li>
<p>If you change your password storage method or complexity rules and need user action, <strong>notify them by email.</strong>
Don’t send password reset links with long expiration—users may click them months later, giving attackers time to exploit them.</p>
</li>
<li>
<p><strong>Never</strong> send a user’s password via email.
Emails are like postcards: anyone can read them.
And if you can email a password, it means you’re not storing it securely.</p>
</li>
<li>
<p>Provide meaningful error messages when users create passwords.
Use labels like “weak,” “strong,” or “very strong,” not entropy scores users won’t understand.</p>
</li>
<li>
<p>Ensure passwords are transmitted via HTTPS.
Ban HTTP completely.</p>
</li>
<li>
<p>For extra security, implement authentication chains, meaning two-factor authentication (e.g., with a smartphone token) in addition to a password.</p>
</li>
</ul>]]></content:encoded>
    </item>
  </channel>
</rss>
