Chapter 7
Chapter 7
Chapter 7
Systems Security
Application Security and Login Security
Application Security (AppSec)
• application security as a shield protecting your software's entire
lifecycle.
• It's a set of practices, tools, and processes designed to keep
applications secure from various cyber threats. This includes:
• Protecting data and code: AppSec aims to prevent theft,
unauthorized access, or manipulation of data and the application's
code itself.
Application Security (AppSec)
• Secure development lifecycle (SDLC): Security considerations are
integrated throughout the entire development process, from
design to deployment.
• Identifying vulnerabilities: AppSec involves finding weaknesses in
applications that attackers could exploit.
• Fixing and preventing vulnerabilities: Once vulnerabilities are
identified, they are patched or addressed to prevent future attacks.
Login Security
• Login security is a specific aspect of application security that focuses on
protecting the login process.
• It ensures that only authorized users can access an application or
account. Here are some key aspects of login security:
• Authentication: This verifies a user's identity through methods like
usernames and passwords, multi-factor authentication (MFA), or
biometrics (fingerprint scan).
• Authorization: Even after successful authentication, users are only
granted access to the specific features or data they are authorized for.
Login Security
• Strong passwords and password management: Encouraging strong
passwords and secure storage practices helps prevent unauthorized
access.
• Account lockout after failed attempts: Limiting login attempts after a
certain number of failures thwarts brute-force attacks.
Boot Loader Security (LILO and GRUB)
• Boot loaders like LILO (Linux Loader) and GRUB (Grand Unified
Bootloader) are crucial programs that initiate the boot process on
your system.
• They load the operating system kernel into memory and prepare the
environment for it to run.
• However, securing your bootloader is important to prevent
unauthorized access to your system.
LILO (Less Common):
• Simpler Security: LILO is a simpler bootloader compared to GRUB.
• It doesn't offer a command interface, so there's no risk of an attacker
gaining interactive access before the kernel loads.
• Limited Protection: However, LILO's security features are limited.
LILO (Less Common):
• It allows password protection, preventing someone from booting a
specific operating system or entering single-user mode without the
password.
• Outdated Technology: LILO is considered an older technology and is
not actively developed anymore.
• Modern systems typically use GRUB.
GRUB (More Common):
• More Features, More Complexity: GRUB offers a wider range of
features than LILO, including a command interface.
• This complexity also introduces potential security risks if not
configured properly.
• Password Protection: Similar to LILO, GRUB allows password
protection for entries in the boot menu.
GRUB (More Common):
• This prevents unauthorized users from selecting a specific operating
system to boot.
• Secure Boot: Modern systems with UEFI firmware often utilize Secure
Boot, a feature that restricts the operating systems that can be
booted.
• GRUB can be configured to work with Secure Boot for added security
Cont..
• GRUB Configuration Security:
• The security of your GRUB configuration file (/boot/grub/grub.cfg) is
crucial.
• Ensure it has proper permissions (owned by root and read-only for
others) to prevent unauthorized modification.
Here are some general boot loader security practices:
• Enable password protection: Use a strong password for your boot loader
to prevent unauthorized access to different boot options.
• Keep software updated: Ensure your boot loader is updated with the
latest security patches for known vulnerabilities.
• Secure boot configuration file: Maintain proper permissions on your
boot loader configuration file to prevent tampering.
• Physical security: Consider physical security measures like locking your
computer case to prevent unauthorized tampering with the boot process.
Cont..
• boot loader security is just one aspect of overall system
security.
• It's important to maintain
• strong passwords,
• keep your operating system and applications updated,
• be on alert about potential threats.
TCP Wrappers Configuration
• TCP Wrappers is a legacy host-based access control system for
restricting access to network services on Unix-like systems.
• It works by allowing administrators to define rules in configuration
files that specify which hosts can access specific services.
Configuration Files:
• /etc/hosts.allow: This file defines rules that permit access to services.
The rules are processed first.
• /etc/hosts.deny: This file defines rules that deny access to services.
Rules are processed only if no matching rule is found in
/etc/hosts.allow.
Cont…
Rule Format:
Each line in the configuration files follows a specific format:
<service_name>: <client_spec>[: <option1>[:<option2>...]]
•<service_name>: This specifies the service being controlled (e.g., sshd, ftp).
•<client_spec>: This defines which hosts are allowed or denied access. It can be:
•Start with a DROP policy: Begin with a default DROP policy for the INPUT chain to ensure a
secure starting point.
•Explicitly allow desired traffic: Define specific rules to allow only the necessary incoming
and outgoing traffic based on your system's purpose.
•Restrict access: Use granular rules to restrict access to specific IP addresses, ports, and
protocols.
•Log suspicious traffic: Consider logging dropped packets for monitoring and
troubleshooting purposes.
•Test and verify: Always test your rules carefully to avoid accidentally blocking legitimate
traffic.
Iptables Scenarios: Packet Filtering, Port Forwarding, and NAT
• Iptables can be used for various network traffic control scenarios. Here's
an overview of three common ones:
1. Packet Filtering:
• Packet filtering is the core functionality of iptables.
• It allows you to define rules based on criteria like source/destination IP
addresses, ports, and protocols to control which traffic flows through your
system.
Cont..
• Scenario: You want to allow SSH access to your server only from
specific IP addresses for enhanced security. Here's a sample rule:
iptables -A INPUT -p tcp --dport 22 -s 192.168.1.10 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j DROP
This configuration:
•Allows SSH (tcp protocol, destination port 22) connections only from the
•IP address 192.168.1.10 using the ACCEPT action.
•The second rule drops any other incoming SSH connections using the
DROP action.
Cont..
2. Port Forwarding/Redirection:
• Port forwarding allows you to redirect incoming traffic on a specific
port to a different port on your local machine or another machine on
your network.
• This is useful for directing incoming requests to specific services.
Cont..
• Scenario: You have a web server running on port 8080 on your
machine, but you want users to access it using the standard web port
80. Here's a sample rule:
• iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination
127.0.0.1:8080
This configuration:
•Uses the nat table, specifically the PREROUTING chain, to intercept
traffic before it reaches the local machine.
•The rule redirects (DNAT) any incoming traffic on port 80 (tcp protocol) to your
local machine (127.0.0.1) on port 8080.
Cont…
3. Network Address Translation (NAT)/IP Masquerading:
• NAT allows you to translate the source IP address of outgoing traffic
from your private network to a public IP address.
• This is typically used when your network has a single public IP address
shared by multiple devices.
Cont…
• Scenario: You have multiple devices on your private network behind a
router with a single public IP address.
• You want all outgoing traffic from these devices to appear to originate
from the router's public IP. Here's a configuration snippet:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
This configuration:
•Uses the POSTROUTING chain in the nat table to manipulate outgoing traffic (-o eth0
specifies the outgoing interface).
•The MASQUERADE target automatically translates the source IP address of outgoing
packets to the public IP address of the router interface.
Packet-Processing Model