Giter Club home page Giter Club logo

week4websecurity's Introduction

Project 4 - Forgery, Theft, and Hijacking Prevention

Time spent: 7 hours spent in total

User Stories

The following required functionality is completed:

1. [x] Required: Test for initial vulnerabilities

2. [ x] Required: Configure sessions

  • [ x] Required: Only allow session IDs to come from cookies
  • [ x] Required: Expire after one day
  • [ x] Required: Use cookies which are marked as HttpOnly

3. [ x] Required: Complete Login page.

  • [ x] Required: Show an error message when username is not found.
  • [ x] Required: Show an error message when username is found but password does not match.
  • [ x] Required: After login, store user ID in session data.
  • [ x] Required: After login, store user last login time in session data.
  • [ x] Required: Regenerate the session ID at the appropriate point.

4. [ x] Required: Require login to access staff area pages.

  • [ x] Required: Add a login requirement to almost all staff area pages.
  • [ x] Required: Write code for last_login_is_recent().

5. [ x] Required: Complete Logout page.

  • [ x] Required: Add code to destroy the user's session file after logging out.

6. [ x] Required: Add CSRF protections to the state forms.

  • [ x] Required: Create a CSRF token.
  • [ x] Required: Add CSRF tokens to forms.
  • [ x] Required: Compare tokens against the stored version of the token.
  • [ x] Required: Only process forms data sent by POST requests.
  • [ x] Required: Confirm request referer is from the same domain as the host.
  • [ x] Required: Store the CSRF token in the user's session.
  • [ x] Required: Add the same CSRF token to the login form as a hidden input.
  • [ x] Required: When submitted, confirm that session and form tokens match.
  • [ x] Required: If tokens do not match, show an error message.
  • [ x] Required: Make sure that a logged-in user can use pages as expected.x

7. [x ] Required: Ensure the application is not vulnerable to XSS attacks.

8. [x ] Required: Ensure the application is not vulnerable to SQL Injection attacks.

9. [x ] Required: Run all tests from Objective 1 again and confirm that your application is no longer vulnerable to any test.

The following advanced user stories are optional:

  • Bonus Objective 1: Identify security flaw in Objective #4 (requiring login on staff pages)

    • Identify the security principal not being followed.
    • Write a short description of how the code could be modified to be more secure.
  • Bonus Objective 2: Add CSRF protections to all forms in the staff directory

  • Bonus Objective 3: CSRF tokens only valid for 10 minutes.

  • Bonus Objective 4: Sessions are valid only if user-agent string matches previous value.

  • Advanced Objective: Set/Get Signed-Encrypted Cookie

    • Create "public/set_secret_cookie.php".
    • Create "public/get_secret_cookie.php".
    • Encrypt and sign cookie before storing.
    • Verify cookie is signed correctly or show error message.
    • Decrypt cookie.

Video Walkthrough

Here's a walkthrough of implemented user stories:

Video Walkthrough

GIF created with LiceCap.

Notes

Describe any challenges encountered while building the app.

License

Copyright [2017] [Tsenddavaa Ganbat]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

week4websecurity's People

Contributors

tgdev24 avatar

Watchers

 avatar

week4websecurity's Issues

Project Feedback!

Hello Tsenddavaa,

๐Ÿ‘ Nice work! You have learned to prevent the most critical web development vulnerabilities. These are far from the only pitfalls in web development, but they are the most commonly exploited. Through them, you should also have a broad understanding of the types of targets hackers choose and the techniques used to exploit them. Other exploits are similar and often involve small variations on these vulnerabilities.

Make sure you have a firm grasp on the following concepts. You should be able to describe in words to someone else how each vulnerability could be exploited, why hackers would want to exploit it, and how to prevent it.

  • Cross-Site Scripting
  • SQL Injection
  • Cross-Site Request Forgery
  • Cookie Theft and Manipulation
  • Session Hijacking
  • Session Fixation

If you have any particular questions about the assignment or the feedback, email us at [email protected].

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.