Giter VIP home page Giter VIP logo

serverless-mfa-api's Introduction

Serverless MFA API

A Serverless API for registering and validating Multi-Factor Authentication methods.

Currently supports Time-based One Time Passwords (TOTP) and FIDO U2F devices (YubiKeys).

For details about the various API endpoints, see the RAML file.

Basic Workflow

  • A consumer of this API does a POST to /api-key, providing an email address.
    • NOTE: To keep this API from being wide open to anyone, we protect our endpoints at/under /api-key with API Gateway's built-in api keys, which must be provided as an x-api-key header in the HTTP request.
  • We create a new API Key and email it to that email address.
    • NOTE: At the moment, we do not actually send that email, since our use case is so limited that we can simply look up the API Key in the database. For local development, run make list-dev-api-keys to see it.
  • The consumer does a POST to /api-key/activate, providing the email address and the API Key.
  • We respond with an API Secret (which is actually an AES key, which we will use for encrypting their data), saving a strongly hashed copy of that API Secret for validating later calls that provide the API Secret.

TOTP

  • The consumer does a POST to /totp, providing their API Key and API Secret in the headers.
  • We respond with a UUID, TOTP key, and QR Code, and we encrypt that TOTP key using the API Secret, storing the result.
  • The consumer at some point does a POST to /totp/{uuid}/validate, providing their API Key and API Secret in the headers and the 6-digit code in the body.
  • We get the TOTP records we have for that API Key, retrieve the one with the given UUID, use the (validated) API Secret to decrypt that TOTP key, and use the TOTP key to check the given 6-digit code for validity.

U2F Registration

  • The consumer does a POST to /u2f, providing their API Key and API Secret in the headers as well as the appId in the JSON body.
  • We respond with an object including the UUID for further API calls as well as the challenge object to be passed along to the browser's u2f.register() call.
  • The consumer uses the u2f.register() javascript API call in the browser.
  • The end user inserts their FIDO U2F device and the light should be blinking and the user presses the button on the device.
  • Pressing the button will trigger the callback method provided to the u2f.register() call which should pass the response object to the consumer's service, which in turn can make a PUT call to /u2f/{uuid} with a JSON body including a property named signResult with a value of the object returned from the U2F device.
  • We will validate the response and store the keyHandle and publicKey encrypted by the consumer's API Secret and respond with a success or error message.

U2F Authentication

  • The consumer does a POST to /u2f/{uuid}/auth, providing their API Key and API Secret in the headers.
  • We respond with the challenge object to be passed along to the browser's u2f.sign() call.
  • The end user inserts their FIDO U2F device and the light should be blinking and the user presses the button on the device.
  • Pressing the button will trigger the callback method provided to the u2f.sign() call which should pass the response object to the consumer's service, which in turn can make a PUT call to /u2f/{uuid}/auth with a JSON body including a property named signResult with a value of the object returned from the U2F device.
  • We will validate the signResult and respond with a success or error message.

Notes about FIDO U2F

Automated Backups

While DynamoDB supports On Demand backups as well as Continuous Backups with Point-in-time Recovery (PITR), both of these methods restore to a new table rather than restoring to the existing DynamoDB table. While turning on Point-in-time Recovery is certainly not a bad idea, we have ended up using an alternate approach to make restores easier.

The shevchenkos/DynamoDbBackUp software sets up Lambda functions that are triggered each time the associated DynamoDB table is changed, and it backs up the records to an S3 bucket. We used it to set up automated backups for each of the DynamoDB tables used by this repo. We also forked it (to https://github.com/silinternational/DynamoDbBackUp) in case the original "shevchenkos/DynamoDbBackUp" repo is ever deleted, but if the original repo is available use it, as it will more likely be up-to-date.

For the shevchenkos/DynamoDbBackUp software to be able to make the necessary changes in your AWS account, you will need to set up an IAM user with an Access Key and Secret and with a policy similar to the following. Note that you will need to replace YOUR IP ADDRESS BLOCK CIDR with a real value (for the IP address or range of addresses from which you want the following commands to allowed). You may also want to narrow down the breadth of permissions granted here, further restrict statements by IP CIDR, restrict S3 paths, etc.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "iam:CreateRole",
            "Resource": "arn:aws:iam::*:role/*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "iam:*",
            "Resource": "arn:aws:iam::*:role/LambdaBackupDynamoDBToS3",
            "Condition": {
                "IpAddress": {
                    "aws:SourceIp": "YOUR IP ADDRESS BLOCK CIDR"
                }
            }
        },
        {
            "Effect": "Allow",
            "Action": [
                "cloudformation:*"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "dynamodb:*"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iam:AttachRolePolicy",
                "iam:CreatePolicy",
                "iam:CreateRole",
                "iam:DeleteRole",
                "iam:DeleteRolePolicy",
                "iam:GetRole",
                "iam:PassRole",
                "iam:PutRolePolicy"
            ],
            "Resource": [
                "arn:aws:iam:::*",
                "arn:aws:iam:::role/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "lambda:*"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:*"
            ],
            "Resource": [
                "arn:aws:logs:*::log-group:*:log-stream:"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::*",
                "arn:aws:s3:::*/*"
            ]
        }
    ]
}

Once you have the shevchenkos/DynamoDbBackUp software set up on your computer, you can use commands like the following to set up your automated backups.

Create the S3 bucket:

gulp deploy-s3-bucket \
    --s3bucket yourorg.backups.dynamodb.mfa-api \
    --s3region us-east-1

(Note: Some of these commands, including the one above, had to be run twice to get past an apparent race condition.)

If actually setting up these backups for your use of this library, you will need to run the following commands once for each of the production tables (currently mfa-api_prod_api-key, mfa-api_prod_totp, and mfa-api_prod_u2f)

Set up the Lambda function for backing up changes:

gulp deploy-lambda \
    --s3bucket yourorg.backups.dynamodb.mfa-api \
    --s3prefix mfa-api_prod_api-key \
    --s3region us-east-1 \
    --dbregion us-east-1 \
    --lName backup_dynamodb_mfa-api_prod_api-key \
    --lRegion us-east-1 \
    --lAlias active \
    --lRoleName LambdaBackupDynamoDBToS3 \
    --lTimeout 60

Set up the event to trigger the Lambda function when a specific DynamoDB table is changed:

gulp deploy-lambda-event \
    --dbtable mfa-api_prod_api-key \
    --dbregion us-east-1 \
    --lName backup_dynamodb_mfa-api_prod_api-key \
    --lRegion us-east-1 \
    --lAlias active

Do an initial full backup:

gulp backup-full \
    --s3bucket yourorg.backups.dynamodb.mfa-api \
    --s3prefix mfa-api_prod_api-key \
    --s3region us-east-1 \
    --dbtable mfa-api_prod_api-key \
    --dbregion us-east-1

If you want to do a restore to a specific point in time (in this example, Thu, 25 Jan 2018 22:10:00 GMT), you would run the following:

gulp restore \
    --s3bucket yourorg.backups.dynamodb.mfa-api \
    --s3prefix mfa-api_prod_totp \
    --s3region us-east-1 \
    --dbtable mfa-api_prod_totp \
    --dbregion us-east-1 \
    --restoretime 1516918200000

(Note: The restore time is a JavaScript timestamp, in milliseconds.)

Running locally

To run this locally (such as for development)...

  1. Open a terminal to THIS repo's root folder and run the following:
    • make dynamodb-tables
      • NOTE: You may need to run this twice. If it gives an error message, trying again should work. I think it's a timing issue, where it tries to create the dynamodb tables before the local dynamodb is actually up enough to be ready for interaction.
    • make dev-server
  2. Add and activate api-key entry for yourself in your local serverless-mfa-api:
    • Submit a POST to https://localhost:8080/prod/api-key with a JSON body like the following:
      { "email": "[email protected]" }
      It should return a 204 No Content response.
    • Run make list-dev-api-keys, and copy the "value" parameter's value.
    • Do a POST to https://localhost:8080/prod/api-key/activate, with a JSON body like the following:
      {
      "email": "[email protected]",
      "apiKey": "the-value-parameter-from-the-dynamo-db-table"
      }
      It should return a 200 OK with a JSON body containing an apiSecret that you will need. When copying that value, make sure you include any trailing equals signs (=).
  3. Clone the https://github.com/silinternational/idp-in-a-box repo.
  4. Put the apiSecret returned (including any trailing = signs) and the apiKey value you used in the JSON body into your local idp-in-a-box code's /docker-compose/broker/local.env file, both for the MFA_TOTP_* and MFA_U2F_* environment variables, something like this (but using YOUR values for the apiKey and apiSecret entries, not these dummy/sample values):
    MFA_TOTP_apiBaseUrl=http://localhost:8080/
    MFA_TOTP_apiKey=347a15dc60f014bdd93e4fc59aab607b022c8e19
    MFA_TOTP_apiSecret=za3c5Op8XgQcWNK16Rg6Th3ndmJ2ZTGL4uEldAJxDes=
    
    MFA_U2F_apiBaseUrl=http://localhost:8080/
    MFA_U2F_apiKey=347a15dc60f014bdd93e4fc59aab607b022c8e19
    MFA_U2F_apiSecret=za3c5Op8XgQcWNK16Rg6Th3ndmJ2ZTGL4uEldAJxDes= 
    
  5. Bring up the idp-in-a-box repo. See that repo's README.md for instructions.

Serverless

To start a local container for development of Serverless configuration:

docker-compose run --rm dev bash

Credential Rotation

AWS Serverless User

  1. Use the Terraform CLI to taint the old access key
terraform taint module.serverless-user.aws_iam_access_key.serverless
  1. Run a new plan on Terraform Cloud
  2. Review the new plan and apply if it is correct
  3. Copy the new key and secret from the Terraform output into GitHub Repository Secrets

Glossary

  • API Key: A hex string used to identify calls to most of the endpoints on this API. We store a copy of this in the database.
  • API Secret: A base-64 encoded random value used to encrypt/decrypt the consumer's data. We store a salted, stretched hash of this (as we would a password) for validating later calls that provide an API Secret.
  • TOTP Key: The secret used for generating TOTP values. This is provided to the consumer of this API for them to show as a string / QR Code to their end user. We store an encrypted copy of this (encrypted using the API Secret) so that when we need to verify given 6-digit code, we can do so.

serverless-mfa-api's People

Contributors

baggerone avatar briskt avatar christophgysin avatar dependabot[bot] avatar fillup avatar forevermatt avatar hobbitronics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

serverless-mfa-api's Issues

CVE-2020-11022 (Medium) detected in jquery-1.7.2.min.js, jquery-2.1.3.min.js

CVE-2020-11022 - Medium Severity Vulnerability

Vulnerable Libraries - jquery-1.7.2.min.js, jquery-2.1.3.min.js

jquery-1.7.2.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/jmespath/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/jmespath/index.html

Dependency Hierarchy:

  • jquery-1.7.2.min.js (Vulnerable Library)
jquery-2.1.3.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • jquery-2.1.3.min.js (Vulnerable Library)

Found in HEAD commit: 9950a13fc77011a71294b00f0f687f6624570541

Vulnerability Details

In jQuery versions greater than or equal to 1.2 and before 3.5.0, passing HTML from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

Publish Date: 2020-04-29

URL: CVE-2020-11022

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/

Release Date: 2020-04-29

Fix Resolution: jQuery - 3.5.0


Step up your Open Source Security Game with WhiteSource here

CVE-2015-9251 (Medium) detected in jquery-1.7.2.min.js, jquery-2.1.3.min.js

CVE-2015-9251 - Medium Severity Vulnerability

Vulnerable Libraries - jquery-1.7.2.min.js, jquery-2.1.3.min.js

jquery-1.7.2.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/jmespath/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/jmespath/index.html

Dependency Hierarchy:

  • jquery-1.7.2.min.js (Vulnerable Library)
jquery-2.1.3.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • jquery-2.1.3.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

jQuery before 3.0.0 is vulnerable to Cross-site Scripting (XSS) attacks when a cross-domain Ajax request is performed without the dataType option, causing text/javascript responses to be executed.

Publish Date: 2018-01-18

URL: CVE-2015-9251

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://nvd.nist.gov/vuln/detail/CVE-2015-9251

Release Date: 2018-01-18

Fix Resolution: jQuery - v3.0.0


Step up your Open Source Security Game with WhiteSource here

CVE-2016-10735 (Medium) detected in bootstrap-3.3.2.min.js

CVE-2016-10735 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: f0409987361b1f32bdf28f5ea69c2eea308dade8

Vulnerability Details

In Bootstrap 3.x before 3.4.0 and 4.x-beta before 4.0.0-beta.2, XSS is possible in the data-target attribute, a different vulnerability than CVE-2018-14041.

Publish Date: 2019-01-09

URL: CVE-2016-10735

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#20184

Release Date: 2019-01-09

Fix Resolution: 3.4.0


Step up your Open Source Security Game with WhiteSource here

Is it okay to never store the API Secret, and to use it to encrypt the TOTP Keys?

We considered using the API Secret (that we generate and provide to the consumer of the API) as the AES key for encrypting the TOTP Keys. Then, since we would not store the API Secret, we would not be able to expose the TOTP Keys because we couldn't even decrypt a consumer's TOTP Keys until they call us with the correct API Secret.

However, if we do that then we have no way to know whether they are in fact using the API Secret we gave them. We would have to consider their API Key as sufficient to confirm that they are who they say they are, and they could pass us "abc" as their API Secret and we might not know the difference.

Is that sufficient reason for us to store something related to their API Secret? We could treat it as a password, and store a salted, stretched hash of it, then verify that hash before using the given API Secret to encrypt/decrypt their TOTP Key(s).

Thoughts?

CVE-2019-8331 (Medium) detected in bootstrap-3.3.2.min.js

CVE-2019-8331 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

In Bootstrap before 3.4.1 and 4.3.x before 4.3.1, XSS is possible in the tooltip or popover data-template attribute.

Publish Date: 2019-02-20

URL: CVE-2019-8331

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#28236

Release Date: 2019-02-20

Fix Resolution: bootstrap - 3.4.1,4.3.1;bootstrap-sass - 3.4.1,4.3.1


Step up your Open Source Security Game with WhiteSource here

CVE-2012-6708 (Medium) detected in jquery-1.7.2.min.js

CVE-2012-6708 - Medium Severity Vulnerability

Vulnerable Library - jquery-1.7.2.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/jmespath/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/jmespath/index.html

Dependency Hierarchy:

  • jquery-1.7.2.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

jQuery before 1.9.0 is vulnerable to Cross-site Scripting (XSS) attacks. The jQuery(strInput) function does not differentiate selectors from HTML in a reliable fashion. In vulnerable versions, jQuery determined whether the input was HTML by looking for the '<' character anywhere in the string, giving attackers more flexibility when attempting to construct a malicious payload. In fixed versions, jQuery only deems the input to be HTML if it explicitly starts with the '<' character, limiting exploitability only to attackers who can control the beginning of a string, which is far less common.

Publish Date: 2018-01-18

URL: CVE-2012-6708

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://nvd.nist.gov/vuln/detail/CVE-2012-6708

Release Date: 2018-01-18

Fix Resolution: jQuery - v1.9.0


Step up your Open Source Security Game with WhiteSource here

Possibly avoid O's in the TOTP seed provided to the user

Since the "shared secret" (aka. seed) that we provide (in case the user can't scan the QR code) is base32-encoded, it can contain any capital letter as well as the numbers 2 through 7.

Unfortunately, the capital letter O can be hard to distinguish from a zero, even when using fixed-width fonts. And since the seed string will never contain a zero, you won't get the benefit of seeing an O and a 0 next to each other in order to be able to tell the difference.

This is certainly an edge case, since most of the time people will be scanning a QR code. However, if it's not too much trouble, what if we simply avoided using any seed values that contain an O?

That would effectively reduce the number of possible values (assuming our seed is 16 characters long) from 32^16 down to 31^16, but that's still a very large number of possible seeds. With any kind of rate-limit protection at all, it seems like a negligible increase in the chances of an attacker compromising your TOTP by brute force.

CVE-2020-28472 (High) detected in aws-sdk-2.660.0.tgz

CVE-2020-28472 - High Severity Vulnerability

Vulnerable Library - aws-sdk-2.660.0.tgz

AWS SDK for JavaScript

Library home page: https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.660.0.tgz

Path to dependency file: serverless-mfa-api/package.json

Path to vulnerable library: serverless-mfa-api/node_modules/aws-sdk/package.json

Dependency Hierarchy:

  • aws-sdk-2.660.0.tgz (Vulnerable Library)

Found in HEAD commit: f0409987361b1f32bdf28f5ea69c2eea308dade8

Found in base branch: develop

Vulnerability Details

This affects the package @aws-sdk/shared-ini-file-loader before 1.0.0-rc.9; the package aws-sdk before 2.814.0. If an attacker submits a malicious INI file to an application that parses it with loadSharedConfigFiles , they will pollute the prototype on the application. This can be exploited further depending on the context.

Publish Date: 2021-01-19

URL: CVE-2020-28472

CVSS 3 Score Details (9.8)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: High
    • Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=2020-28472

Release Date: 2021-01-19

Fix Resolution: aws-sdk-2.814.0,@aws-sdk/shared-ini-file-loader-1.0.0-rc.9


Step up your Open Source Security Game with WhiteSource here

CVE-2018-20677 (Medium) detected in bootstrap-3.3.2.min.js

CVE-2018-20677 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

In Bootstrap before 3.4.0, XSS is possible in the affix configuration target property.

Publish Date: 2019-01-09

URL: CVE-2018-20677

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20677

Release Date: 2019-01-09

Fix Resolution: Bootstrap - v3.4.0;NorDroN.AngularTemplate - 0.1.6;Dynamic.NET.Express.ProjectTemplates - 0.8.0;dotnetng.template - 1.0.0.4;ZNxtApp.Core.Module.Theme - 1.0.9-Beta;JMeter - 5.0.0


Step up your Open Source Security Game with WhiteSource here

CVE-2019-11358 (Medium) detected in jquery-2.1.3.min.js

CVE-2019-11358 - Medium Severity Vulnerability

Vulnerable Library - jquery-2.1.3.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • jquery-2.1.3.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

jQuery before 3.4.0, as used in Drupal, Backdrop CMS, and other products, mishandles jQuery.extend(true, {}, ...) because of Object.prototype pollution. If an unsanitized source object contained an enumerable proto property, it could extend the native Object.prototype.

Publish Date: 2019-04-20

URL: CVE-2019-11358

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-11358

Release Date: 2019-04-20

Fix Resolution: 3.4.0


Step up your Open Source Security Game with WhiteSource here

CVE-2018-14040 (Medium) detected in bootstrap-3.3.2.min.js

CVE-2018-14040 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

In Bootstrap before 4.1.2, XSS is possible in the collapse data-parent attribute.

Publish Date: 2018-07-13

URL: CVE-2018-14040

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#26630

Release Date: 2018-07-13

Fix Resolution: org.webjars.npm:bootstrap:4.1.2,org.webjars:bootstrap:3.4.0


Step up your Open Source Security Game with WhiteSource here

CVE-2018-20676 (Medium) detected in bootstrap-3.3.2.min.js

CVE-2018-20676 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: f0409987361b1f32bdf28f5ea69c2eea308dade8

Vulnerability Details

In Bootstrap before 3.4.0, XSS is possible in the tooltip data-viewport attribute.

Publish Date: 2019-01-09

URL: CVE-2018-20676

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-20676

Release Date: 2019-01-09

Fix Resolution: bootstrap - 3.4.0


Step up your Open Source Security Game with WhiteSource here

WS-2018-0021 (Medium) detected in bootstrap-3.3.2.min.js

WS-2018-0021 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: /tmp/ws-scm/serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: /serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: dc36967297eeeb0c844069f746754ab216b67103

Vulnerability Details

XSS in data-target in bootstrap (3.3.7 and before)

Publish Date: 2017-06-27

URL: WS-2018-0021

CVSS 2 Score Details (6.5)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#20184

Release Date: 2019-06-12

Fix Resolution: 3.4.0


Step up your Open Source Security Game with WhiteSource here

Rename repo

Since this now supports U2F and potentially more in the future, can we rename totp-api to mfa-api?

WS-2020-0070 (High) detected in lodash-4.17.15.tgz

WS-2020-0070 - High Severity Vulnerability

Vulnerable Library - lodash-4.17.15.tgz

Lodash modular utilities.

Library home page: https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz

Path to dependency file: /tmp/ws-scm/serverless-mfa-api/package.json

Path to vulnerable library: /tmp/ws-scm/serverless-mfa-api/node_modules/lodash/package.json

Dependency Hierarchy:

  • cucumber-6.0.5.tgz (Root Library)
    • lodash-4.17.15.tgz (Vulnerable Library)

Found in HEAD commit: 31b1c0aa8ad10e5a8d51782ffe6ef31dd6188248

Vulnerability Details

a prototype pollution vulnerability in lodash. It allows an attacker to inject properties on Object.prototype

Publish Date: 2020-04-28

URL: WS-2020-0070

CVSS 3 Score Details (8.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: High
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: High
    • Availability Impact: High

For more information on CVSS3 Scores, click here.


Step up your Open Source Security Game with WhiteSource here

WS-2018-0021 (Medium) detected in bootstrap-3.3.2.min.js

WS-2018-0021 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: /tmp/ws-scm/serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: /serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

XSS in data-target in bootstrap (3.3.7 and before)

Publish Date: 2017-06-27

URL: WS-2018-0021

CVSS 2 Score Details (6.5)

Base Score Metrics not available

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#20184

Release Date: 2019-06-12

Fix Resolution: 3.4.0


Step up your Open Source Security Game with WhiteSource here

How long should our secret be when generating the TOTP secret?

@fillup / @wcjr / @Baggerone

tl;dr - What balance do we want to strike between longer TOTP Key length (= more protection against... what?) vs. shorter code for a user to (possibly) type in?

  • default = 52 chars
  • Daplie demo = 32 chars
  • Authy in-app example = 16 chars
  • Slack = 16 chars

I had been using the default ({length: 32}), giving a TOTP Key (base32) string that is 52 characters long. That's really painful to try to type in (which is an option for users that can't scan a QR code).

The daplie demo generates a TOTP key 32 characters long, which seems to be a TOTP secret length of 20.

When manually typing the code into Authy, the example they give is 16 characters long, so a TOTP secret length of 10.

Slack also produces a code 16 characters long (so {length: 10}).

My inclination is to follow Slack's example, and generate codes that are 16 - 20 characters long.

Distinguish between invalid API Key and incorrect TOTP 6-digit code?

For the /totp/{uuid}/validate endpoint, should we distinguish between an invalid API Key (currently set to return a 401 Unauthorized) and an incorrect 6-digit code (currently set to return a 401 Unauthorized)?

I think we have the following situations to consider:

  • No matching API Key found
  • No matching TOTP uuid found in that API Key record
  • Incorrect TOTP code (aka. 6-digit number)

For an incorrect API Key, 401 seems fitting.

For requests with a valid API Key and an incorrect uuid, I could see a 404 being a possibly good option, though that might (in theory) enable people to discover valid API Keys be trying random values until they get a 404 instead of a 401 (as long as we're not validating the API Secret in any way). That said, there are approx. 10^48 possible values (20 Bytes of random data), so it's unlikely, and we can easily increase the number of Bytes.

For incorrect TOTP codes... I'm not sure what would be a good design. This is the one that really seems like it should be different, even if the other two scenarios both receive a 401.

@fillup / @wcjr / @Baggerone , thoughts?

CVE-2020-7656 (Medium) detected in jquery-1.7.2.min.js

CVE-2020-7656 - Medium Severity Vulnerability

Vulnerable Library - jquery-1.7.2.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/jmespath/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/jmespath/index.html

Dependency Hierarchy:

  • jquery-1.7.2.min.js (Vulnerable Library)

Found in HEAD commit: f0409987361b1f32bdf28f5ea69c2eea308dade8

Vulnerability Details

jquery prior to 1.9.0 allows Cross-site Scripting attacks via the load method. The load method fails to recognize and remove "<script>" HTML tags that contain a whitespace character, i.e: "</script >", which results in the enclosed script logic to be executed.

Publish Date: 2020-05-19

URL: CVE-2020-7656

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: GHSA-q4m3-2j7h-f7xw

Release Date: 2020-05-28

Fix Resolution: jquery - 1.9.0


Step up your Open Source Security Game with WhiteSource here

CVE-2021-23343 (Medium) detected in path-parse-1.0.6.tgz

CVE-2021-23343 - Medium Severity Vulnerability

Vulnerable Library - path-parse-1.0.6.tgz

Node.js path.parse() ponyfill

Library home page: https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz

Path to dependency file: serverless-mfa-api/package.json

Path to vulnerable library: serverless-mfa-api/node_modules/path-parse/package.json

Dependency Hierarchy:

  • cucumber-6.0.5.tgz (Root Library)
    • resolve-1.16.1.tgz
      • path-parse-1.0.6.tgz (Vulnerable Library)

Found in HEAD commit: f0409987361b1f32bdf28f5ea69c2eea308dade8

Found in base branch: develop

Vulnerability Details

All versions of package path-parse are vulnerable to Regular Expression Denial of Service (ReDoS) via splitDeviceRe, splitTailRe, and splitPathRe regular expressions. ReDoS exhibits polynomial worst-case time complexity.

Publish Date: 2021-05-04

URL: CVE-2021-23343

CVSS 3 Score Details (5.3)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: Low

For more information on CVSS3 Scores, click here.


Step up your Open Source Security Game with WhiteSource here

CVE-2018-14042 (Medium) detected in bootstrap-3.3.2.min.js

CVE-2018-14042 - Medium Severity Vulnerability

Vulnerable Library - bootstrap-3.3.2.min.js

The most popular front-end framework for developing responsive, mobile first projects on the web.

Library home page: https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • bootstrap-3.3.2.min.js (Vulnerable Library)

Found in HEAD commit: bc7a5cb545c98937d5fc3a8b979879b0177a757a

Vulnerability Details

In Bootstrap before 4.1.2, XSS is possible in the data-container property of tooltip.

Publish Date: 2018-07-13

URL: CVE-2018-14042

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: twbs/bootstrap#26630

Release Date: 2018-07-13

Fix Resolution: org.webjars.npm:bootstrap:4.1.2.org.webjars:bootstrap:3.4.0


Step up your Open Source Security Game with WhiteSource here

CVE-2020-11023 (Medium) detected in jquery-1.7.2.min.js, jquery-2.1.3.min.js

CVE-2020-11023 - Medium Severity Vulnerability

Vulnerable Libraries - jquery-1.7.2.min.js, jquery-2.1.3.min.js

jquery-1.7.2.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/jmespath/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/jmespath/index.html

Dependency Hierarchy:

  • jquery-1.7.2.min.js (Vulnerable Library)
jquery-2.1.3.min.js

JavaScript library for DOM operations

Library home page: https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js

Path to dependency file: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Path to vulnerable library: serverless-mfa-api/node_modules/knuth-shuffle-seeded/index.html

Dependency Hierarchy:

  • jquery-2.1.3.min.js (Vulnerable Library)

Found in HEAD commit: f0409987361b1f32bdf28f5ea69c2eea308dade8

Vulnerability Details

In jQuery versions greater than or equal to 1.0.3 and before 3.5.0, passing HTML containing elements from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e. .html(), .append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

Publish Date: 2020-04-29

URL: CVE-2020-11023

CVSS 3 Score Details (6.1)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: Required
    • Scope: Changed
  • Impact Metrics:
    • Confidentiality Impact: Low
    • Integrity Impact: Low
    • Availability Impact: None

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11023

Release Date: 2020-04-29

Fix Resolution: jquery - 3.5.0


Step up your Open Source Security Game with WhiteSource here

Review full code for first release

We are proceeding with less-than-normal code reviews on one or more of the initial pull requests, so we'll accordingly want to remember that and do a full review of our initial release PR.

Return QR Code or `otpauth://...` URL?

Rather than returning the generated QR Code, should we also/instead return the otpauth://... URL? That would allow the code calling this API to modify the URL to include things like a service name and username before generating the QR Code, which seems like it would result in a better experience for the end user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.