Security Advisories (3)
CVE-2021-35472 (2021-07-30)

An issue was discovered in LemonLDAP::NG before 2.0.12. Session cache corruption can lead to authorization bypass or spoofing. By running a loop that makes many authentication attempts, an attacker might alternately be authenticated as one of two different users.

CVE-2021-35473

OAuth2 handler does not verify access token validity

CVE-2026-19349 (2026-08-16)

Lemonldap::NG::Portal versions from 2.0.0 before 2.16.9, from 2.17.0 before 2.21.5, from 2.22.0 before 2.23.3 for Perl allow authentication bypass via an OAuth2 state parameter stored as an SSO session in the GitHub and LinkedIn backends. Before redirecting to the identity provider, extractFormInfo() creates the state session with the positional call `getApacheSession( undef, 1, 0, 'GitHubState' )`. getApacheSession() takes a session id followed by a named argument hash, so the trailing arguments become that hash, `kind` defaults to SSO, and the state is written to the global session storage as a regular SSO session. Its identifier is handed to the unauthenticated visitor as the state parameter of the redirection URL. Any visitor who reaches the GitHub or LinkedIn endpoint can replay that identifier as a session cookie and obtain a valid SSO session without authenticating. The session holds neither _user nor authenticationLevel, which the shipped bootstrap configuration accepts because it grants virtual hosts a "default => accept" access rule; deployments whose rules test the user or require an authentication level are less exposed. Only configurations with the GitHub or LinkedIn authentication module enabled are affected.

NAME

Lemonldap::NG::Portal::Main::SecondFactor - Base class for Lemonldap::NG::Portal second factor plugins.

SYNOPSIS

package Lemonldap::NG::Portal::2F::MySecondFactor;
use Mouse;
# Import used constants
use Lemonldap::NG::Portal::Main::Constants qw(
  PE_OK
  PE_BADCREDENTIALS
  PE_SENDRESPONSE
);
extends 'Lemonldap::NG::Portal::Main::SecondFactor';

# INITIALIZATION

# Prefix that will be used in parameter names. The form used to enter the
# second factor must post its result to "/my2fcheck" (if "my" is the prefix).
has prefix => ( is => 'ro', default => 'my' );
# Optional logo
has logo => ( is => 'rw', default => 'mylogo.png' );

# Required init method
sub init {
    my ($self) = @_;
    # Insert here initialization process
    #
    # If self registration is enabled and "activation" is set to "enabled",
    # replace the rule to detect if user has registered a device key.
    # The rule must be like this :
    # By example :
    $self->conf->{u2fActivation} = '$_2fDevices =~ /"type":\s*"U2F"/s'
    # Optionally, the rule can be : '$_2fDevices and $_2fDevices =~ /"type":\s*"U2F"/s'
    # to avoid warning due to undef variable
    #
    # Required call:
    return $self->SUPER::init();
}

# RUNNING METHODS

# Required 2nd factor send method
sub run {
    my ( $self, $req, $token ) = @_;
    # $token must be inserted in a hidden input in your form with the name
    # "token"
    ...
    # A LLNG constant must be returned. Example:
    $req->response($my_psgi_response)
    return PE_SENDRESPONSE;
}
# Required 2nd factor verify method
sub verify {
    my ( $self, $req, $session ) = @_;
    # Use $req->param('field') to get POST responses
    ...
    if($result eq $goodResult) {
      return PE_OK;
    }
    else {
      return PE_BADCREDENTIALS
    }
}

Enable your plugin in lemonldap-ng.ini, section [portal]:

<prefix>2fActivation (required): 1, 0 or a rule
<prefix>2fAuthnLevel (optional): change authentication level for users authenticated by this plugin

Example:

[portal]
customPlugins = Lemonldap::NG::Portal::2F::MyPlugin
my2fActivation = 1
my2fAuthnLevel = 4

DESCRIPTION

Lemonldap::NG::Portal::Main::SecondFactor provides a simple framework to build Lemonldap::NG second authentication factor plugin.

See Lemonldap::NG::Portal::Plugins::2F::* packages for examples.

SEE ALSO

http://lemonldap-ng.org

OTHER POD FILES

Writing an authentication module: Lemonldap::NG::Portal::Auth
Writing a UserDB module: Lemonldap::NG::Portal::UserDB
Writing a second factor module: Lemonldap::NG::Portal::Main::SecondFactor
Writing an issuer module: Lemonldap::NG::Portal::Main::Issuer
Writing another plugin: Lemonldap::NG::Portal::Main::Plugin
Request object: Lemonldap::NG::Portal::Main::Request
Adding parameters in the manager: Lemonldap::NG::Manager::Build

AUTHORS

LemonLDAP::NG team http://lemonldap-ng.org/team

BUG REPORT

Use OW2 system to report bug or ask for features: https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues

DOWNLOAD

Lemonldap::NG is available at http://forge.objectweb.org/project/showfiles.php?group_id=274

COPYRIGHT AND LICENSE

See COPYING file for details.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.