1. Homepage
  2. Programming
  3. COMP3334 Computer Systems Security Project: End-to-end encrypted chat web application

COMP3334 Computer Systems Security Project: End-to-end encrypted chat web application

Engage in a Conversation
HK PolyUCOMP3334Computer Systems SecurityEnd-to-end encrypted chatWeb ApplicationPython

COMP3334 Project CourseNana.COM

End-to-end encrypted chat web application CourseNana.COM

Semester 2, 2023/2024 CourseNana.COM

Overview CourseNana.COM

Nowadays, web services are the most common form of applications that users are exposed to. Web browsers become the most popular application on a computer that enables users to access those web services. Ensuring the security of web services is essential for the Internet. Moreover, privacy of communications is an important feature of modern times. Your job is to implement an end-to-end encrypted chat web application and secure various aspects of the website. CourseNana.COM

Objectives CourseNana.COM

  1. Adapt a basic chat web application to become a secure E2EE chat web app CourseNana.COM

  2. Comply with some of the requirements in NIST Special Publication 800-63B “Digital Identity Guidelines – Authentication and Lifecycle Management” for US federal agencies (which is also a reference for other types of systems) CourseNana.COM

  3. Implement a secure MFA mechanism based on passwords and OTP (or FIDO2) CourseNana.COM

  4. Encrypt communications between two users so that the server does not know the content of the messages (E2E encryption) CourseNana.COM

  5. Protect communications in transit by configuring a modern TLS deployment CourseNana.COM

  6. Package a docker image of your web app CourseNana.COM

Requirements (authentication) CourseNana.COM

1. From NIST Special Publication 800-63B:
1. Comply with all SHALL and SHOULD requirements from sections listed below 2. Use the following authenticators: CourseNana.COM

User-chosen Memorized Secret (i.e., password/passphrase) and Single-Factor OTP Device (e.g., Google Authenticator) CourseNana.COM

or Single-Factor Cryptographic Device (e.g., Yubikey) if you have one and Look-Up Secrets (recovery keys)
Comply with related requirements in §5.1 and §4.2.2 CourseNana.COM

  • §5.1.1.2: “Memorized secrets SHALL be salted and hashed using a suitable one-way key derivation function” CourseNana.COM

    See our Password Security lecture for an appropriate function CourseNana.COM

  • Memorized Secret Verifiers (§5.1.1.2) CourseNana.COM

Choose “Passwords obtained from previous breach corpuses” and refer to https://haveibeenpwned.com/API/v3#PwnedPasswords for the corpus to check against CourseNana.COM

§5.2.8 and §5.2.9 are automatically complied CourseNana.COM

Requirements (authentication) CourseNana.COM

1. From NIST Special Publication 800-63B:
3. §5.2.2: Implement rate-limiting mechanisms AND image-based CAPTCHAs
4. Implement new account registration and bind authenticators (OTP/Yubikey and recovery keys) at
CourseNana.COM

the same time
Optional: provide a way to change authenticators after account registration CourseNana.COM

5. §7.1: Implement proper session binding requirements 6. Exceptions: CourseNana.COM

OTP authenticators — particularly software-based OTP generators — SHOULD discourage and SHALL NOT facilitate the cloning of the secret key onto multiple devices. CourseNana.COM

Google Authenticator and related apps are OK CourseNana.COM

Requirements (E2EE chat) CourseNana.COM

2. Once users are logged in, secure chat messages between two users in a way so that the server cannot decrypt the messages CourseNana.COM

  1. Use the ECDH key exchange protocol to establish a shared secret between two users CourseNana.COM

    Leverage the WebCrypto API, see demo https://webkit.org/demos/webcrypto/ecdh.html Exchanged information during the key exchange can be sent through the server CourseNana.COM

    The server is trusted not to modify messages of the key exchange Choose P-384 as the underlying curve CourseNana.COM

  2. Derive two 256-bit AES-GCM encryption keys and two 256-bit MAC keys from the shared secret using HKDF-SHA256
    One key for encryption between user1 to user2, and another one from user2 to user1
    Using WebCrypto API again, see https://developer.mozilla.org/en- CourseNana.COM

    US/docs/Web/API/HkdfParams CourseNana.COM

    The salt should be unique so another key derivation in the future produces different keys, use for instance a counter starting at 1 CourseNana.COM

    The info parameter should represent the current context (e.g., “CHAT_KEY_USER1to2” for the key for user1user2, and “CHAT_MAC_USER1to2” for the MAC key for user1user2) CourseNana.COM

Requirements (E2EE chat) CourseNana.COM

2. Once users are logged in, secure chat messages between two users in a way so that the server cannot decrypt the messages
3. Messages will be encrypted using
AES in GCM mode CourseNana.COM

96-bit IVs are counters representing the number of messages encrypted with the same key Note: GCM does not require unpredictable IVs, but unique IVs CourseNana.COM

  • Send the IV together with the ciphertext to the recipient CourseNana.COM

  • As a recipient, verify that IV > IV to prevent replay attacks CourseNana.COM

𝑖𝑖 𝑖𝑖−1 CourseNana.COM

  • Protect the IV with HMAC-SHA256 using the derived MAC key to prevent the attacker from choosing IVs CourseNana.COM

  • Associated data should reflect the current context (e.g., “CHAT_MSG_USER1to2”) CourseNana.COM

  • Authentication tags should be 128 bits CourseNana.COM

  1. Store all key material in the HTML5 Local Storage of the browser to be retrieved after the browser CourseNana.COM

    is reopened CourseNana.COM

  2. Display the history of previous messages being exchanged + new messages CourseNana.COM

If Local Storage has been cleared, previous messages cannot be decrypted, show warning CourseNana.COM

Requirements (E2EE chat) CourseNana.COM

2. Once users are logged in, secure chat messages between two users in a way so that the server cannot decrypt the messages
6. All symmetric keys and IVs should be
re-derived from the shared secret when user clicks on a CourseNana.COM

“Refresh” button in the chat (not the browser refresh button), using a new salt CourseNana.COM

  • The participant that requests a change should inform the other party with a special message CourseNana.COM

    composed of the last IV that has been used, the string “change”, altogether protected with the old MAC key AND the new MAC key
    Two different MACs over the message
    The other party should verify the old MAC before processing the message, then derive CourseNana.COM

    new keys and verify again the new MAC before accepting the new keys CourseNana.COM

  • Both parties should show a message “Keys changed” in the chat history CourseNana.COM

  • Old keys should be kept to decrypt older messages when the browser is reopened, you CourseNana.COM

    should identify which set of keys to use for a given message based on the preceding values sent during the key exchange (i.e., keep track of user public keys) CourseNana.COM

Key exchange messages older than a minute should not be considered as a fresh key CourseNana.COM

exchange to engaged into CourseNana.COM

Requirements (E2EE chat) CourseNana.COM

2. Once users are logged in, secure chat messages between two users in a way so that the server cannot decrypt the messages CourseNana.COM

  1. When the Local Storage is cleared, or when there is no shared secret for a given recipient, the CourseNana.COM

    sender should initiate the ECDH key exchange using a special message and the recipient should CourseNana.COM

    engage in the key exchange even when there had been a shared secret previously established CourseNana.COM

  2. Chat messages should be encoded using UTF-8, and network messages between users should be CourseNana.COM

    formatted in JSON using your own schema (e.g., {“type”:”ECDH”, “key”:”...”}, {“type”:”msg”, CourseNana.COM

    “ciphertext”:”...”, “IV”:”...”, “MAC”:”...”}) CourseNana.COM

  3. Use console.log() to log all crypto operations (including key, IV, plaintext, etc.) CourseNana.COM

It should be visually obvious that IVs are not reused, keys change when needed (see next requirements), etc. CourseNana.COM

10. Thechatappshouldbeprotectedagainstcross-siterequestforgery(CSRF),cross-sitescripting (XSS), and SQL injection attacks CourseNana.COM

Requirements (TLS) CourseNana.COM

3. Communications should be encrypted in transit using TLS with the following configuration: Reuse Mozilla’s “modern” configuration for nginx, and change it as needed: CourseNana.COM

https://ssl-config.mozilla.org/ CourseNana.COM

  1. TLS version 1.3 only CourseNana.COM

  2. x25519 Elliptic Curve Group only CourseNana.COM

  3. TLS_CHACHA20_POLY1305_SHA256 cipher suite only CourseNana.COM

  4. No OCSP stappling (since you will use a self-signed CA certificate) CourseNana.COM

  5. HSTS for one week CourseNana.COM

  6. TLS certificate requirements: CourseNana.COM

    1. X.509 version 3
    2. ECDSA public key over P-384
    3. SHA384 as hashing algorithm for signature
    4. CA flag (critical): false
    5. Key Usage (critical) = Digital Signature
    6. Extended Key Usage = Server Authentication
    7. Include both Subject Key Identifier and Authority Key Identifier 8. Validity period = 90 days
    CourseNana.COM

Requirements (TLS) CourseNana.COM

3. Communications should be encrypted in transit using TLS with the following configuration:Issue the certificate from the given CA certificate and private key CourseNana.COM

  1. Use the domain name corresponding to your group CourseNana.COM

    Domain should appear as both Common Name and Subject Alternative Name CourseNana.COM

  2. TheCAcertificateisdomain-constrainedtosubdomainsofcomp3334.xavier2dc.fr,meaning CourseNana.COM

    you can safely trust it on your computer (nobody can generate valid certificates for other domains) CourseNana.COM

Simple Chat Demo CourseNana.COM

  1. Deploy the docker container using the following line within the folder that contains the docker- compose.yaml file: CourseNana.COM

    $ sudo docker-compose up -d CourseNana.COM

  2. Open a new private window of your browser and access the website again 1. Chrome: CourseNana.COM

    2. Firefox: CourseNana.COM

  3. Login as Alice (password: password123) on the first window CourseNana.COM

  4. Login as Bob (password: password456) on the second (private) window CourseNana.COM

  5. Select Bob as contact from Alice’s chat, select Alice as contact from Bob’s chat CourseNana.COM

  6. Send messages each other! CourseNana.COM

  7. When modifying the server-side (app.py) or client-side (login.html, chat.html), simply restart the CourseNana.COM

    docker container, you do not need to rebuild the container: $ sudo docker restart [you-container-name]-webapp-1 CourseNana.COM

Areas of assessments CourseNana.COM

  1. Explanations of your solution and design [50%]
    Provide list of features/requirements implemented
    Describe how your solution works, especially explain how user passwords are CourseNana.COM

    stored, verified, which libraries do you use, how key materials are derived, how CourseNana.COM

    do you store them, their size, how do you generate the domain certificate, etc. Show autonomy and creativity when requirements allow CourseNana.COM

  2. Implementation of your solution & demo [50%] CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
HK PolyU代写,COMP3334代写,Computer Systems Security代写,End-to-end encrypted chat代写,Web Application代写,Python代写,HK PolyU代编,COMP3334代编,Computer Systems Security代编,End-to-end encrypted chat代编,Web Application代编,Python代编,HK PolyU代考,COMP3334代考,Computer Systems Security代考,End-to-end encrypted chat代考,Web Application代考,Python代考,HK PolyUhelp,COMP3334help,Computer Systems Securityhelp,End-to-end encrypted chathelp,Web Applicationhelp,Pythonhelp,HK PolyU作业代写,COMP3334作业代写,Computer Systems Security作业代写,End-to-end encrypted chat作业代写,Web Application作业代写,Python作业代写,HK PolyU编程代写,COMP3334编程代写,Computer Systems Security编程代写,End-to-end encrypted chat编程代写,Web Application编程代写,Python编程代写,HK PolyUprogramming help,COMP3334programming help,Computer Systems Securityprogramming help,End-to-end encrypted chatprogramming help,Web Applicationprogramming help,Pythonprogramming help,HK PolyUassignment help,COMP3334assignment help,Computer Systems Securityassignment help,End-to-end encrypted chatassignment help,Web Applicationassignment help,Pythonassignment help,HK PolyUsolution,COMP3334solution,Computer Systems Securitysolution,End-to-end encrypted chatsolution,Web Applicationsolution,Pythonsolution,