WP Manifestindependent plugin directory
manifest / users / saml-sso

SAML SSO WP Registry grade B. Medium-severity findings · 2 findingsWP RegistryMedium-severity findings · 2 findingsOpen the reportB

SAML SSO solution for Wordpress

★ 0stars
11release downloads
55composer installs
v1.0.2latest · 5 years ago

Install

Download full-release.zip From the v1.0.2 release on GitHub, Oct 29, 2020

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/helsingborg-stad/saml-sso/releases/download/v1.0.2/full-release.zip

On Packagist as helsingborg-stad/sso-saml:

composer require helsingborg-stad/sso-saml
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Contributors Forks Stargazers Issues License

Logo

SAML SSO

SAML SSO plugin for Wordpress
Report Bug · Request Feature

Table of Contents

About SAML SSO

SAML SSO login plugin for wordpress. This plugin will add 3 endpoints required for SAML SSO to operate.

/saml/acs
/saml/logout
/saml/metadata

NOTE: Currently only invokable programatically se usage for instructions.

Built With

Getting Started

To get a local copy up and running follow these steps.

Prerequisites

Installation

  1. Clone the repo
    git clone https://github.com/helsingborg-stad/saml-sso.git
  2. Install Composer packages
    composer install

Configuration

Configuration is done with constants in wp-config.php
PHP-SAML constants is in direct relation to settings the PHP-SAML require.
Check documentation in PHP SAML for more information about these settings.

Example configuration:

// NOTE Never place certificates below the root web folder!
$idpCertificateFile = '/etc/certs/idp-cert.cer';
$spCertificateFile = '/etc/certs/sp-cert.cer';
$spCertificateKeyFile = '/etc/certs/sp-cert.key';

define('SAML_SP_ENITITY_ID', 'https://www.example.com/saml/metadata');
define('SAML_SP_ACS_URL', 'https://www.example.com/saml/acs');
define('SAML_IDP_ENTITY_ID', 'https://www.example.com/adfs/services/trust');
define('SAML_IDP_SSO_URL', 'https://www.example.com/adfs/ls/');
define('SAML_IDP_SLS_URL', 'https://www.example.com/adfs/ls/');

if (file_exists($idpCertificateFile)) {
    define('SAML_IDP_CERTIFICATE', file_get_contents($idpCertificateFile));
}

if (file_exists($spCertificateFile)) {
    define('SAML_SP_CERTIFICATE', file_get_contents($spCertificateFile));
}

if (file_exists($spCertificateKeyFile)) {
    define('SAML_SP_CERTIFICATE_KEY', file_get_contents($spCertificateKeyFile));
}

Required PHP-SAML Constants

The below constants is required to be set in your wp-config.php file.

SAML_SP_ENITITY_ID
SAML_SP_ACS_URL
SAML_SP_CERTIFICATE
SAML_SP_CERTIFICATE_KEY
SAML_IDP_ENTITY_ID
SAML_IDP_SSO_URL
SAML_IDP_SLS_URL

Optional PHP-SAML Constants

Optional constants and their default value to be set in your wp-config.php file.

SAML_STRICT => true
SAML_DEBUG => false
SAML_SP_ACS_BINDING => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
SAML_SP_NAME_ID_FORMAT => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
SAML_IDP_SSO_BINDING => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
SAML_IDP_SLS_BINDING => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
SAML_IDP_CERTIFICATE => null,
SAML_SECURITY_REQUESTED_AUTHN_CONTEXT => false,
SAML_SECURITY_SIGNATURE_ALGORITHM' => 'http://www.w3.org/2001/04/xmlenc#sha256',
SAML_SECURITY_DIGEST_ALGORITHM' => 'http://www.w3.org/2001/04/xmlenc#sha256',
SAML_SECURITY_LOWERCASE_URL_ENCODING => true,

Additional PHP-SAML settings.

Additional PHP-SAML settings can be added with the saml-sso-settings filter.

Other constants

Two constants is present for mapping configuration.
Overwrite this with constants SAML_ATTRIBUTES_MAPPING and SAML_AD_GROUP_ROLE_MAPPING in wp-config-php.

Default values:

SAML_ATTRIBUTES_MAPPING = [
    'username' => 'http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname',
    'first-name' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname',
    'last-name' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname',
    'email' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress',
    'ad-groups' => 'http://schemas.xmlsoap.org/claims/Group',
];

SAML_MAP_TO_AD_GROUP = true;

SAML_AD_GROUP_ROLE_MAPPING = [
    'Domain Users' => 'subscriber',
    'Domain Admins' => 'administrator'
];

Usage

When configured and plugin is activated, the code below can be used to trigger a SAML SSO login.

if (class_exists('\SAMLSSO\Client')) {
    $client = new \SAMLSSO\Client();
    // Supply where to redirect after login.
    $client->authenticate('https://www.example.com/redirect');
}

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License.

Acknowledgements

Releases

3 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.0.2 latest
Oct 29, 2020 5 years ago
full-release.zip
5
Oct 29, 2020 5 years ago
full-release.zip
3
Oct 26, 2020 5 years ago
full-release.zip
3
B grade

Security

SAML SSO 1.0.2 · audited by WP Registry

Medium-severity findings.

1 medium 1 low
Audited release
1.0.2
Findings
2
Worst severity
medium
Content hash
8b965e49201884cd1dd27d36…

Findings

  • medium Open redirect via RelayState and redirect_to after SAML authentication

    unsafe_input

    ACS::run() ends with $client->saml->redirectTo($_POST['RelayState']) with no allowlist. Client::simulateSignon() uses wp_redirect($_GET['redirect_to']) without wp_validate_redirect/wp_safe_redirect. An attacker who can influence RelayState (common in SP-initiated flows) or redirect_to can send a freshly authenticated user to an external phishing site.

    source/php/Endpoints/ACS.php:16-38

    Recommendation

    Validate RelayState/redirect_to with wp_validate_redirect() against home_url() (or an explicit allowlist) before redirecting.

  • low ACS error output not escaped

    missing_escaping

    SAML processing errors are echoed via implode without escaping, which can become reflected XSS if the library includes request-controlled text in error strings.

    source/php/Endpoints/ACS.php:23-26

    Recommendation

    Escape with esc_html() before output.

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.