Code Monkey home page Code Monkey logo

dvsa's Introduction

alt OWASP DVSA

a Damn Vulnerable Serverless Application


Damn Vulnerable Serverless Application (DVSA) is a deliberately vulnerable application aiming to be an aid for security professionals to test their skills and tools in a legal environment, help developers better understand the processes of securing serverless applications and to aid both students & teachers to learn about serverless application security in a controlled class room environment.

The aim of DVSA is to practice some of the most common serverless vulnerabilities, with a simple straightforward interface.

Please note, there are both documented & undocumented vulnerabilities with this software. This is intentional. You are encouraged to try and discover as many issues as possible.


Disclaimer

Do not install DVSA on a production account

We do not take responsibility for the way in which any one uses this application (DVSA). We have made the purposes of the application clear and it should not be used maliciously. We have given warnings and taken measures to prevent users from installing DVSA on to production accounts.


Deployment from Application Repository

  • Deploy DVSA from the AWS Serverless Application Repository

  • After deployment is complete. Click on 'View CloudFormation Stack'

  • Under 'Outputs' you will find the URL for the application (DVSA Website URL)


Local Development & Deployment

Client

Prerequisites for re-building client
Build client
  • $ ./dvsa.sh client-build
Update client file with previously deployed backend
  • $ ./dvsa.sh client-connect --stack <STACK_NAME>
Updating deployed client with local changes
  • $ ./dvsa.sh client-update --stack/--bucket
  • $ ./dvsa.sh client-update -h/--help for more options
Run Client locally
  • $ ./dvsa.sh client-start

Backend

Prerequisites for building backend
Step-by-Step:
  • Make desired changes to backend code under backend/functions
  • Make desired changes to your cloudformation template.yml
  • If you need post-deployment changes, you can add files to backend/deployment/ and use the backend/deployment/dvsa_init.py function that runs at the end of the deployment to execute the required actions.
  • $ ./dvsa.sh package-template (OPTIONAL: -h/--help for more options)
  • Deploy the output template-file with Cloudformation console/cli

Run Backend locally

Note: If you want to point your local client to your local backend, run $ ./dvsa.sh client-connect and REPLACE the endpoint of ServiceEndpoint with http://localhost:3000 (It will still be using the Cognito pools in AWS).

Email subscription

DVSA sends receipts in the email. You can use the built-in Inbox page within the application to get the emails and obtain the receipts. Each user will be automatically assigned an email from 1secmail.com which will be automatically verified. Real emails will be sent to their account and will appear in the application Inbox page.

If you want users to receive emails to their actual registered email account (e.g. gmail):

  • Send an email verification link to the desired email address, by running the following command (after clicking on the received link, emails will also be sent to their actual email address):

aws ses verify-email-identity --email-address <your_email>


Additional Info

Presentation

Download

Documentation

AWS

see LESSONS for information about hacking DVSA.

see VIDEOS for how to deploy, use and hack DVSA.


Links

OWASP Top 10 - Serverless Interpretation

Deep-Dive into Serverless Attacks - Series

OWASP Serverless Top 10 Project

Twitter account (hackable)

Slack Channel #project-sls-top-10

DVSA blog post

In the News


Acknowledgements

DVSA was created by Tal Melamed


License

Damn Vulnerable Serverless Application (DVSA) 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 3 of the License, or (at your option) any later version.

Damn Vulnerable Serverless Application (DVSA) 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 Damn Vulnerable Serverless Application (DVSA). If not, see http://www.gnu.org/licenses/.

dvsa's People

Contributors

4ppsec avatar ariellee-tm avatar brandone avatar chan9390 avatar davidcervigni avatar hblankenship avatar indigocarmen avatar maysonchen-cs avatar ottimo avatar paralax avatar spaglipa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dvsa's Issues

be-stack.json file missing when building client

Looks like a json file is missing in the src directory.

ERROR in ./src/utils/apiCaller.js
Module not found: Error: Can't resolve '../be-stack.json' in '/Volumes/5TB/Code/DVSA/client/src/utils'
@ ./src/utils/apiCaller.js 16:26-53
@ ./src/components/StorePage.js
@ ./src/routers/AppRouter.js
@ ./src/app.js

ERROR in ./src/aws-exports.js
Module not found: Error: Can't resolve './be-stack.json' in '/Volumes/5TB/Code/DVSA/client/src'
@ ./src/aws-exports.js 25:26-52
@ ./src/app.js

Code Missing?

The README suggests that the first step in installing this application is running nom install. However I cannot find a package.json file or for that matter any JS code at all. Is the application code stored in another repository? Or is the code purposely not available as a matter of exercise?

Thanks in advance.

got "[ERROR] DVSA backend does not work properly. Try to delete cache and re-login."

After deploy the application, I created a new user and logged in. After log in, the application shows a popup with the error message: "[ERROR] DVSA backend does not work properly. Try to delete cache and re-login."

I have investigated and this happens because the POST request to https://6u6eaiz6kk.execute-api.us-east-1.amazonaws.com/user/order return a 500 status code error, with the following response headers:

x-amzn-errortype: InternalServerErrorException
x-cache: Error from cloudfront

By examining the logs, it is caused by some nodejs missing dependencies. Has any other got this error? How to fix the missing dependencies error?

Cannot deploy Serverless Repo to AWS lambda

I think the issue has to do with this:

The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: ..................)

https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html

https://aws.amazon.com/blogs/compute/node-js-12-x-runtime-now-available-in-aws-lambda/

Any chance this can be fixed?

npm i , Error with node version 8 (working with version 10)

npm ERR! Linux 4.15.0-45-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2

npm ERR! Invalid Package: expected serverless-plugin-protego-fsp but found serverless-protego-plugin
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/david/workspace/DVSA/backend/src/functions/order-api/npm-debug.log

npm ERR! Linux 4.15.0-45-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: cd client && npm i && cd ../backend/src/functions/order-api && npm i
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'cd client && npm i && cd ../backend/src/functions/order-api && npm i'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dvsa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cd client && npm i && cd ../backend/src/functions/order-api && npm i
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dvsa
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dvsa
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/david/workspace/DVSA/npm-debug.log

Attach File is not working in Feedback Information

When you try to create feedback and attach the file is not being uploaded to the feedback S3 bucket
The fix still not working. It still failing

Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
Looks like there is error here: Uncaught (in promise) TypeError: Cannot read property 'key' of undefined at bundle.js:308

store profile info in localStorage

After successful login - application should send {"action": "profile"} and store the information received in the response in client localStorage

orders page

Create orders page in the application that shows the list of orders and their status in the ui.

backend already supports this information. simply call:

{"action": "orders"}

Returned json should be parsed into a table. Order-id should be clickable.

When clicked - end request {"action": "get", "order-id": id} and show data in the response json

If order has status "incomplete" - allow user to delete it using request: {"action": "cancel", "order-id": id}

Problems I'm having with lessons... willing to understand and learn

Ok, I don't want to open multiple issues for something that may be completely my fault, so I'll add things here if you don't mind

  • Broken Authentication Open - Api

POST /default/DVSA-PAYMENT-PROCESSOR HTTP/1.1

I always get {"message":"Forbidden"} although it doesn't require an Authorization header.

packaging freezes for long time

I have experienced this with two different linux distro (ubuntu and centos) and on mac os as well:
The issue looks similar to:
serverless/serverless#3882
sometimes it works after more than say 15 minutes hanging...

david@ubuntu:~/workspace/DVSA$ sls deploy
Running command: python backend/serverless/scripts/onstart.py
############################################################################

██████╗ ██╗ ██╗███████╗ █████╗

██╔══██╗██║ ██║██╔════╝██╔══██╗

██║ ██║██║ ██║███████╗███████║

██║ ██║╚██╗ ██╔╝╚════██║██╔══██║

██████╔╝ ╚████╔╝ ███████║██║ ██║

╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝

You are deploying DVSA: a Damn vulnerable Serverless Application

This project was donated to OWASP by Protego Labs (https://protego.io)

Make sure you read all the necessary information on the project page:

https://github.com/owasp/dvsa | online version: http://serverless.fail

############################################################################

Serverless: Packaging service...

profile page

  1. add profile page and show response from localStorage allow user to update "email", "shipping", "billing", "avatar".

  2. when updating - send request to: {"action": "account", "data": }

  3. for avatar upload. convert to base64 using code from here: https://stackoverflow.com/questions/6150289/how-to-convert-image-into-base64-string-using-javascript

and send to imgur: POST "https://api.imgur.com/3/image", headers={"Authorization": "Client-ID {}".format(clientid) (coming from the server) data: "image="

(clientID: b05581f073b24c4)

  1. the response is a json. if res["success"] url= res["link"]. the link should be sent in the "account" update request

DVSA CREATE_failed

I am trying to deploy DVSA from serverless repository, every time it throws create failed error, can anyone help me through this?

Deployable on OpenFaaS or OpenWhisk

Dear DVSA Team,

Hope you are doing well. Thank you for providing the DVSA application. We were wondering if there's a way to deploy the DVSA on OpenFaaS or OpenWhisk in private deployments?

^ I have a very limited knowledge in serverless, so might be a stupid question to ask. On the other hand, does deploying applications on serverless platform increases the security of the application in some way? I believe the benefits are more in terms of cost? We would really appreciate a bit of insight.

Thank you
bitvijays

auto filling

when filling in shipping and billing have a check button to copy from account default.

this information is stored (insecurely) in the localStorage

Error Deploying DVSA

When trying to deploy DVSA I encountered an error with the S3 Bucket Permissions, I kept getting 403s, I believe I have fixed the issue by fixing the references to the S3 buckets. I believe since the buckets referenced in the policies were done by a function there was a race condition where the permission policy would attempt to be created before the S3 bucket was finished creating.
Untitled

I swapped the reference to the actual buckets in the Cloudformation template and it appears to be working now.

Capture

Step by step guide - "npm i" fails with error

npm ERR! herror
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: make failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/home/ec2-user/environment/dvsa-repo/client/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 4.14.296-222.539.amzn2.x86_64
npm ERR! gyp ERR! command "/home/ec2-user/.nvm/versions/node/v16.18.1/bin/node" "/home/ec2-user/environment/dvsa-repo/client/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/ec2-user/environment/dvsa-repo/client/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.18.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ec2-user/.npm/_logs/2022-12-10T22_03_04_213Z-debug-0.log
npm ERR! code 1
npm ERR! path /home/ec2-user/environment/dvsa-repo
npm ERR! command failed
npm ERR! command sh -c -- cd client && npm i && cd ../backend/src/functions/order-api && npm i

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ec2-user/.npm/_logs/2022-12-10T22_02_55_450Z-debug-0.log

When I deploy backend,I got the error “The CloudFormation template is invalid...."

When I deploy backend,I get the error "The CloudFormation template is invalid: Template format error: Unrecognized resource types: [AWS::Cognito::UserPool, AWS::Cognito::IdentityPoolRoleAttachment, AWS::Cognito::UserPoolClient, AWS::Cognito::IdentityPool]".

The error part is following:
image

My region is cn-north-1.It is my first time to use aws cli to build a application in Lambda.I don't know where is wrong.

My serverless.yml different is following:
image

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.