Strong Points of System
Layer 1: Physical Layer
Protocol: Used CAT6 cable instead of Wi-Fi.
Analysis: This is an excellent security measure. It's much harder for an attacker to eavesdrop on a wired
connection than a wireless one. It also eliminates the risk of unauthorized access via Wi-Fi spoofing or brute-
forcing Wi-Fi passwords or it removes the vulnerabilities associated with wireless signals (e.g., signal
interception, wardriving). The physical separation provides a strong baseline, which is a robust defense
against physical eavesdropping and unauthorized network access.
Layer 2: Data Link Layer
Protocol: Implemented MAC Address Filtering.
Analysis: By restricting the network to only recognize and communicate with authorized devices' MAC
addresses, you add a critical layer of defense. An attacker can't simply plug into your network and get an IP
address; their device's MAC address must be pre-approved. This works in tandem with your physical layer
security.
Layer 3: Network Layer
Protocol: Implemented Static IP and subnetting ([Link] [Link]) to limit the number of usable
IP addresses.
Analysis: This reduces your network's attack surface. By limiting the number of available IP addresses to only
a few, you make it much harder for an attacker to perform network scans or brute-force attacks. It
compartmentalizes your network, making it harder for an attacker to move laterally if they manage to breach
one device.
Layer 4: Transport Layer
Your Protocol: Your web server-to-client and Pi-to-web server communications use WebSockets with
OpenSSL and Flask with OpenSSL.
Analysis: OpenSSL implements TLS/SSL encryption at this layer. This ensures all data transmitted, including
personal information and encrypted files, is encrypted and protected from man-in-the-middle attacks. It
guarantees the confidentiality and integrity of your data as it travels across the network.
Layer 5 & 6: Session and Presentation Layers
Your Protocol: You use AES-256 encryption, and you slice the encrypted file into three parts, sending them
randomly to the Raspberry Pi. The file is secured with a 37-character combination of alphanumeric and
special symbol passkey.
Analysis: This is a highly sophisticated and unique security strategy. . The passkey acts as a strong session key
for that specific enrollment. Slicing the file and sending the pieces randomly is an innovative way to prevent
an attacker from reconstructing the file, even if they intercept a partial transfer. AES-256 is a military-grade
encryption standard, providing exceptional cryptographic protection at the presentation layer.
Layer 7: Application Layer
Your Protocol: You have user information encoding, anti-facial spoofing, and physical access control based
on successful file decryption.
Analysis: These are your application-specific security controls.
o User Information Encoding: This protects user data from being exposed in plain text.
o Anti-Facial Spoofing: This is a crucial defense against a common attack vector for biometric systems,
preventing unauthorized access using photos or videos.
o Access Control Logic: The final security check at this layer is your brilliant use of the encrypted files. A
professor's access is granted only if the Raspberry Pi can successfully combine, decrypt, and extract
the facial data, proving the legitimacy of the user and the data. This ties the digital security directly to
a physical action (energizing the power to the room), making your system both secure and functional.
Weak Points of System
1. SQL Injection (Database Vulnerability)
While you mentioned "encoding" teacher information, it's not clear how this data is stored. If you are using a
database (like SQLite, MySQL, or PostgreSQL) and the server's code for adding data isn't using prepared statements
or an ORM (Object-Relational Mapper), it could be vulnerable.
Attack Vector: An attacker could try to inject malicious SQL commands into a user input field (e.g., username
or email) to bypass authentication or delete data.
o Example Attack: john'; DROP TABLE users;--
Recommendation: Use a library like SQLAlchemy (an ORM for Python) or parameterized queries to ensure all
user input is treated as data, not as executable code. This is the single most effective defense against SQL
Injection.
2. Denial of Service (DoS)
Your system's real-time nature makes it a target for DoS attacks, which aim to make a service unavailable.
Attack Vector (WebSocket Flood): A malicious client could open thousands of WebSocket connections to
your server or send a flood of messages, exhausting its memory and CPU resources. This would prevent
legitimate devices (like the Raspberry Pi) from communicating, locking out users.
Attack Vector (Physical): The USB camera is a potential point of failure. An attacker could physically damage
the camera, cover it, or shine a bright light into it, preventing it from detecting faces and stopping
authentication.
Recommendation:
1. Rate Limiting: Implement rate limiting on both the Flask and WebSocket servers to limit the number
of connection attempts or messages from a single IP address within a specific time frame.
2. Connection Limits: Configure the WebSocket server to limit the total number of open connections it
will accept at one time.
3. Physical Hardening: Physically secure the camera and Raspberry Pi to prevent tampering or DoS
attacks. You could place the device in a tamper-proof enclosure.
3. Replay Attacks (Custom Protocol Vulnerability)
Your file-slicing and encryption protocol is strong, but it might be vulnerable to a replay attack if not properly
designed.
Attack Vector: An attacker with network access could sniff a valid "unlock" data packet from a legitimate
user. They could then record and resend that packet later to gain unauthorized access. While they don't have
the original file or passkey, the Raspberry Pi might process the exact same "unlock" command again.
Recommendation:
1. Timestamps and Nonces: Add a timestamp and a unique, single-use number (nonce) to every
message from the web server to the Raspberry Pi. The Pi should check that the timestamp is recent
and that the nonce has not been seen before. If the timestamp is old or the nonce is a duplicate, the
message should be rejected.
2. Short-Lived Keys: The 37-character passkey should be used only for that single transaction. Avoid
reusing it for future enrollments or authentication.
4. Vulnerabilities in the Raspberry Pi
The Raspberry Pi itself is an endpoint that needs to be secured.
Attack Vector (Physical Access): If an attacker gains physical access to the Pi, they could insert a USB drive,
modify the code, or steal the SD card, completely bypassing all your software security.
Attack Vector (Unsecured OS): If the default Pi OS has open ports or weak passwords, an attacker who is
inside your network could try to SSH into the Pi and take control.
Recommendation:
1. Physical Security: Physically secure the Pi in a locked cabinet or box that cannot be easily tampered
with.
2. Harden the OS: Change the default password, disable unused services (like SSH if you don't need it),
and keep the operating system and software updated.
5. Weaknesses in Anti-Spoofing
Attack Vector: Anti-spoofing techniques are constantly evolving, but skilled attackers can bypass them using
high-resolution photos on digital screens, 3D masks, or deepfakes.
Recommendation: Ensure your anti-spoofing solution is up to date and can detect various types of spoofing
attempts. Consider adding a liveness detection mechanism that requires the user to perform a random
action (e.g., blink, move their head) to prove they are a live person.