---
# System prepended metadata

title: Hw 6 SS

---

# Hw 6 SS

# 1
Suppose the storage of each password takes 10 bytes and the storage of each hash value takes 5 bytes. Also, as shown in the diagram, each chain consists of 4 passwords and 3 hash values.

![](https://i.imgur.com/M4yyhHY.png)


#### 1.1 

$10^6 * 3 * 5$ bytes = 15 MB
$10^6 * 4 * 10$ bytes = 40 MB

Total estimated storage = 55 MB

#### 1.2

Suppose that the hacker is very lucky and gets a hash value that comes from the original password. Minimum hash function : 1

Suppose that the hacker is very unlucky and found a hash value at the end of the chain. Maximum has calculations $4-1$ = 3


The range : $1 ≤ x ≤ n-1$ where $n$ is the length of chain (in this case is 4)

# 2
Honeywords generates fake password to protect user passwords by creating a fake password to notify the admin when a hacker uses said password. Hackers wouldn't be able to differentiate the actual and fake passwords, since both are hashed and are stored in the database.

A proposed method is by creating a word dictionary of common words/ passwords and use them as honeywords to make sure that when a hacker tries to break into the account by sifting through the commonly used password list, the admins are notified. This method essentially creates a dictionary of possible "hits" that is stored for a certain username. The honeychecker is able to perform 3 different methods to generate 19 different honeywords to acquire `K = 20` "fake" passwords.


The 3 methodologies are as follows:

1. chaffing-by-tweaking
2. chaffing-with-a-password-model
3. hybrid

### chaffing-by-tweaking

This methodology describes tweaking random character or digit in the password. In this project, only take-a-tail method is adopted

#### take-a-tail

This describes the server prompting the user to 'add a tail' (in this case, just random numbers) of at least `t = 4` length.

The reason for such adoption is to ensure flatness.

### chaffing-with-a-password-model

This methodology describes replacing the word input by the user with another word extracted from the dictionary.

### hybrid

This methodology describes both replacing the word and tweaking the tail with random number, of the same length as what the user had input.


The following is an example of what a hybrid method would look like:
```
{'_id': ObjectId('642be00d201b8071bea73399'), 'username': 'jake', 'password0': 'corosif6692', 'password1': 'toucher8620', 'password2': 'baggier4511', 'password3': 'peralta1111', 'password4': 'welting5013', 'password5': 'webworm2530', 'password6': 'tannaic3070', 'password7': 'recheck6649', 'password8': 'pascola5417', 'password9': 'inherle4098', 'password10': 'belayer1002', 'password11': 'gnatter2404', 'password12': 'osteria9730', 'password13': 'snugify4472', 'password14': 'punatoo1281', 'password15': 'fishman4237', 'password16': 'twiglet4989', 'password17': 'spokane1789', 'password18': 'eschele9459', 'password19': 'pipages3538'}
```


This is the function to generate the honeywords:

```python=
def chaffing(method, userid, password, tail, t):
    seed(str(userid))
    true_index = randint(0, K)
    print(f"true_index: {true_index}")
    answer = {}
    for i in range(0, K):
        answer["password" + str(i)] = 0
    if method == 'chaffing-by-tweaking':
        """
        This method will assume tail-tweaking along the password. 
        """
        for i in range(0, len(answer)):
            answer["password" + str(i)] = password + tweak_digit(
                t) if i != true_index else password + tail
        return answer
    elif method == 'chaffing-with-a-password-model':
        """
        Assume that the password is separated by password (alpha) and tail (numeric)
        """
        honeywords = replaceWord(password)
        for i in range(len(answer)):
            answer["password" + str(i)] = honeywords[
                i] + tail if i != true_index else password + tail
        return answer

    elif method == 'hybrid':
        """
        Combines both replace word and tweaking of digits
        """
        honeywords = replaceWord(password)
        for i in range(len(answer)):
            answer["password" + str(i)] = honeywords[i] + tweak_digit(
                t) if i != true_index else password + tail
        return answer
    else:
        print(f"expected 'chaffing-by-tweaking' \
      or 'chaffing-with-a-password-model' \
      or 'hybrid' method \
      but instead, got {method}")
```


ogin to `username=jake` account. (with password `peralta1111`) A demonstration of 3 different outcomes will be displayed:

### Case 1: Matched Original Credentials

![](https://i.imgur.com/0IVsYcG.png)

This occurs when the user/adversary keys in the `sugarword` for password. The `honeychecker` then allows the user to login to their account
### Case 2: Wrong Credentials

![](https://i.imgur.com/Cd2k7qz.png)

The server will not reveal to the adversary which field they got wrong. This protects the user base from getting revealed, which results in brute force attack

### Case 3: Matched the honeyword credentials

![](https://i.imgur.com/Y8nYGzF.png)
This occurs when the adversary keys in the `honeyword` for password. The user should not be expected to forget their own tail and key in the `honeyword`'s tail either, since this generation is not revealed to the user. Hence, it should suffice to say that if a user attempts to login to an account with a honeyword, then the admin and the owner of that account should be immediately notified so that the admin may look at the logs, and that owner should change their password.


Disclaimer: It is understood that passwords should be hashed, but for exercise's sake we did not in order to test the cases.


### Possible Attack Pattern 

Goal: compromise the user login

![](https://i.imgur.com/Rb2Yuun.png)


### Conclusion

Having a honeyword implemented is a fantastic idea, keeping in mind that all passwords should be hashed and/or encrypted before storing in the database meant that an adversary that may have exploited the server and obtained a set of hashes from multiple accounts will have to:

1.  break all the hashes in the sweetwords
2.  conclude which password index contains the sugarword
3.  at risk of `(k-1)/k` probability to getting caught

In recent development, users have also been recommended to increase the length of their password, while the character space of the passwords is no longer as important anymore (i.e., it is sufficient for password to be of `length=20` but only contains alphanumeric).

By enforcing the word length and the tail length, it is possible to strengthen the password bit entropy while increasing the difficulty of the game for the adversary to break.

Such implementation, thus, strengthens the security multifolds. Any hint of an adversary wrongly guessing the user's password will spark an investigation immediately and prompt the owner of that account to change their password.


## System Security Homework 6 Backend

### Engine

Flask (backend)
ReactJS (frontend)
MongoDB (through docker)

### Installation

1. `npm install`
2. `sudo docker pull mongo; sudo docker run --name mongo-db -p 27017:27017 -d mongo:latest`
3. `python3 main.py`



# 3


According to the company's security whitepaper, they use the bcrypt algorithm to hash and salt user passwords. Additionally, they enforce the use of strong passwords and two-factor authentication for added security.

In terms of comparing Dropbox's password storage solution with recent versions of operating systems, it's important to note that most modern operating systems also use hashing and salting to store user passwords securely. For example, Windows 10 and macOS Mojave use the PBKDF2 (Password-Based Key Derivation Function 2) algorithm to hash and salt passwords.

Linux distributions also typically use hashing and salting to store passwords securely, with the default algorithm being SHA-512. However, the specific implementation of password storage can vary depending on the distribution and configuration.

Overall, Dropbox's password storage solution appears to be secure and on par with the password storage solutions used by modern operating systems. It's important to note that while these solutions can help protect against password-based attacks, users should still practice good password hygiene by using strong and unique passwords, and enabling two-factor authentication whenever possible.

#### Table form:
![](https://i.imgur.com/WZ9nm6Y.png)
