32. Linux and Network Hardening
32.5 Web Server Hardening
Apache (/etc/httpd/conf/httpd.conf or a file in /etc/httpd/conf.d/):
ServerTokens Prod
ServerSignature Off
TraceEnable Off
<Directory /var/www/html>
Options -Indexes -Includes
AllowOverride None
</Directory>
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set Content-Security-Policy "default-src 'self'"
Nginx (inside http {} or the server {} block):
server_tokens off;
autoindex off;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
client_max_body_size 10m;
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
PHP (/etc/php.ini): expose_php = Off, display_errors = Off, allow_url_include = Off, and disable_functions = exec,passthru,shell_exec,system if your app does not need them.
Always keep HTTPS with a valid certificate (Chapter 11) and redirect HTTP to HTTPS. Test and reload:
sudo apachectl configtest && sudo service httpd reload
sudo nginx -t && sudo service nginx reload
curl -I https://reels.example.in # check the headers
A WAF (web application firewall) such as ModSecurity or AWS WAF adds another layer against SQLi and XSS, but it never replaces fixing the code (Chapter 29).
Ravindra Bagale's Tip
If you set a very strict Content-Security-Policy, the site's CSS/JS gets blocked and students end up removing the header altogether. First test with Content-Security-Policy-Report-Only, look in the browser console to see what gets blocked, and then apply the real header.
Ravindra Bagale's Tip – मराठी
Content-Security-Policy एकदम कडक लावला तर site चे CSS/JS बंद होतात आणि students तर header च काढून टाकतात. आधी Content-Security-Policy-Report-Only ने test करा, browser console मध्ये काय block होते ते बघा, मग खरा header लावा.
Ravindra Bagale's Tip – हिंदी
Content-Security-Policy बहुत सख़्त लगाया तो site के CSS/JS बंद हो जाते हैं और students header ही हटा देते हैं. पहले Content-Security-Policy-Report-Only से test करो, browser console में देखो क्या block हो रहा है, फिर असली header लगाओ.
Lab
Run Nikto (Chapter 20) against your lab web server and save the output. Apply the Apache or Nginx settings above plus the PHP settings, reload, and run Nikto again. List which findings disappeared and check the new headers with curl -I.
Real incident: Yoido Full Gospel Church – web shell on the ERP server leads to data on 850,000 members (Oct 2026)
1. What happened
On 7 October 2026, Yoido Full Gospel Church in Seoul, South Korea's largest church, said the personal data of 850,000 members may have leaked: names and dates of birth, plus a record of changes that included 2,629 resident registration number changes, 3,964 phone number changes and 7,202 address changes. Korea's internet security agency KISA warned the church at 3 p.m. on 6 October; at 1 a.m. on 7 October the church blocked outside access and changed its server passwords, and it later said it had deleted the malicious files and plans to replace its firewalls. The threat-intelligence firm Oasis Security had found the data on an overseas attacker's server: about 47.3 GB, including about 960,000 member records, about 330,000 donation records, about 68,000 approval documents and 14,706 internal messenger conversations. A second Seoul church, SaRang Church, was also hit (about 89,000 members and 286 staff) through leaked logins and access-control (IDOR) bugs. Oasis said the attack logs mentioned AI sub-agents and looked machine-written, but the exact role of AI is not clear. How the web shell was first placed is not public yet. Educational framing only.
2. How the hack happened (Oasis Security's analysis – high-level)
- The attacker first tried mass logins against South Korean church websites, including this church.
- A web shell – a small script file that lets an outsider run commands through the website – ended up in the web folder of the church's ERP server (the system that runs members, donations and administration).
- The attacker studied the ERP program's own files and decrypted its settings file, which held the database administrator (MSSQL sysadmin) login. The "encryption" key was inside the program, so it protected nothing.
- With database admin rights, they used the database's built-in feature for running system commands and its links to other database servers to reach more servers.
- They got around a database monitoring tool and reached file storage (NAS) and other connected systems.
- They gathered the data in one place and moved about 47.3 GB to their own overseas server. Oasis found that server, and KISA alerted the church.
3. How to stop it / defend (this lesson: web server hardening)
- Web root must not be writable by the web app (Ch.8:
755folders,644files). Only a tightly controlled upload folder may be writable, and scripts must never run from it. - Watch the web root for new script files (
.aspx,.php,.jsp) with file-integrity monitoring or EDR, and hunt for web shells by recently changed files (Ch.6:find -mmin). - Never give the website or app the database admin account. The app should use a low-privilege account that can touch only its own tables.
- Keep secrets out of config files that the app can read and decrypt – use a secrets manager, and change the password if it was ever stored that way.
- Switch off dangerous features you do not need, such as running OS commands from the database – the same idea as PHP
disable_functionsabove. - Segment and limit outbound traffic (32.6): the ERP server should not reach the NAS freely, and tens of gigabytes leaving for an unknown overseas server should raise an alert.
- Rate-limit and alert on mass login attempts (the
limit_reqline above) and put MFA on every admin login.
4. How to take care so it won't happen again (checklist)
- [ ] Run a weekly check for new or changed script files in every web root, and alert on them.
- [ ] List every app's database account and remove admin rights that the app does not need.
- [ ] Search config files for stored passwords, move them to a secrets manager, and rotate them.
- [ ] Turn off database command-execution features and unused links between database servers.
- [ ] Set an alert for unusually large uploads from servers to the internet.
- [ ] India students: schools, temples, trusts and NGOs here also run old ERP and member systems with very little security – apply this checklist, and report incidents to CERT-In within the required time (see Ch.34).
Source: Yoido Full Gospel Church press release, 7 October 2026 (as reported by SBS News and Seoul Economic Daily, 7 October 2026); The Asia Business Daily, Kim Heeyun, "Yoido Full Gospel Church Hacked; Names, Birth Dates of 850,000 Members May Have Been Exposed", 7 October 2026; Oasis Security blog, "Analysis of Cyber Intrusions Targeting Major Religious Organizations in South Korea", October 2026; Seoul Economic Daily, "Two Large Korean Churches Breached, Member and Donation Data Exposed", 6 October 2026; Decrypt, 7 October 2026.
Check if you're safe: Is My Website Hacked? · Website Security Checklist
Real incident: Arara Message (Japan) – up to ~77M email addresses exposed; service suspended (Nov 2026)
1. What happened
In this lesson you learnt that strings, hashes and file types help you tell a real notice from junk – and that a big mail platform holds millions of addresses in one place.
- On 2 November 2026, Japanese email-delivery firm Arara (Paycloud Holdings subsidiary; product Arara Message) published a further notice on unauthorized access.
- It said about 77 million email addresses may have been taken from roughly 97 client servers, affecting up to about 380 companies. Exposed fields could include names, gender, birth dates, phones, membership IDs and addresses. It said it did not hold credit-card numbers.
- Attackers also sent up to about 7.13 million suspicious emails that impersonated credit-card notices.
- The service was fully suspended on 31 October 2026 and remained stopped with no restart date in the early November notices. Japan Times and Jiji covered the same disclosure window around 2–3 November 2026.
2. How the hack happened (public reporting only – high-level)
- Arara Message hosted email-delivery data for many client companies on shared / client servers.
- Attackers gained unauthorized access to those environments (exact first door not fully public in English summaries).
- Large subscriber / address lists were copied; some data was reused to blast phishing-style card emails.
- Arara suspended the service, notified clients and published updated counts (~77M addresses, ~380 firms).
- Clients and end users were told to treat unexpected card emails as suspect and wait for official restart news.
3. How to stop it / defend (this lesson: strings, hashes, careful handling)
Why: one mail SaaS breach can spray phishing that looks “official” because the attacker already has the real address list.
Controls you can use:
- Segment and encrypt customer lists; give support staff least privilege, not a full export.
- Watch odd admin / mail restarts on servers you own (Example 1).
- Inventory where subscriber files live so you know what to freeze after a vendor alert (Example 2).
- Hash and filetype-check any “official notice” sample before you forward it to staff (Example 3).
- Vendor IR clause: how fast they tell you, how they suspend sends, and who owns the customer notice.
- Tell users: Arara / card emails during the outage are phishing until your bank says otherwise.
Example 1: spot recent mail-related admin actions in your auth log.
- Run
sudo grep -iE 'mail|smtp|sendgrid|ses' /var/log/auth.log | tail -n 5 - Output: like
Nov 1 03:12:08 mail sudo: admin : TTY=pts/0 ; USER=root ; COMMAND=/bin/systemctl restart postfix. - What it means: someone restarted mail as root at 3 a.m. – ask why before you ignore it.
Example 2: find subscriber export files on a host you own.
- Run
find /var/lib/mail-app -name '*.sql' -o -name 'subscribers*' 2>/dev/null | head - Output: like
/var/lib/mail-app/exports/subscribers-20261028.csv. - What it means: a full list sits on disk. Lock permissions and stop blind copies to laptops.
Example 3: fingerprint a notice file before sharing it.
- Run
sha256sum /tmp/notice-sample.txt 2>/dev/null; file /tmp/notice-sample.txt 2>/dev/null - Output: like
e3b0c44298fc1c14... /tmp/notice-sample.txt\n/tmp/notice-sample.txt: ASCII text. - What it means: you have a hash and a simple type. Compare with the vendor’s published sample; do not open random .exe “notices”.
4. How to take care so it won't happen again (checklist)
- [ ] Mail-vendor contracts name breach notice time and send-kill switch.
- [ ] Subscriber exports are encrypted, access-logged and rare.
- [ ] Odd overnight mail admin actions page a human.
- [ ] Staff verify vendor notices by hash / official URL, not only by email.
- [ ] Users get a one-line “ignore card mails during outage” banner.
- [ ] After restore, rotate SMTP and API keys the vendor issued.
Source: Arara / Paycloud Holdings Japanese disclosure notice and updates, 2 November 2026; Jiji English, "77 M. Email Addresses Leak from Arara Message Due to Cyberattack"; The Japan Times, more Japan firm breaches including Arara, 3 November 2026; Nikkei xTECH / INTERNET Watch same-window reporting.
1. काय झालं
या lesson मध्ये तुम्ही शिकलात की strings, hashes आणि file types खरा notice आणि junk वेगळे करायला मदत करतात – आणि एक मोठं mail platform एका जागी लाखो addresses ठेवतं.
- 2 नोव्हेंबर 2026 ला Japanese email-delivery company Arara (Paycloud Holdings subsidiary; product Arara Message) ने unauthorized access बद्दल आणखी एक notice प्रकाशित केला.
- ते म्हणाले की सुमारे 97 client servers वरून सुमारे 77 million email addresses घेतले गेले असतील, ज्याचा परिणाम सुमारे 380 companies पर्यंत होऊ शकतो. Exposed fields मध्ये names, gender, birth dates, phones, membership IDs आणि addresses असू शकतात. Credit-card numbers त्यांच्याकडे नव्हते असं त्यांनी सांगितलं.
- Attackers नी credit-card notices ची नक्कल करणारे सुमारे 7.13 million suspicious emails सुद्धा पाठवले.
- Service 31 ऑक्टोबर 2026 ला पूर्णपणे suspend झाली आणि नोव्हेंबरच्या सुरुवातीच्या notices मध्ये restart date नव्हती. Japan Times आणि Jiji नी 2–3 नोव्हेंबर 2026 च्या आसपास हीच disclosure window cover केली.
2. हॅक कसा झाला (फक्त जाहीर माहितीवरून – थोडक्यात)
- Arara Message अनेक client companies साठी email-delivery data shared / client servers वर ठेवत होतं.
- Attackers ना त्या environments वर unauthorized access मिळालं (इंग्रजी summaries मध्ये पहिलं दार पूर्ण public नाही).
- मोठ्या subscriber / address lists copy झाल्या; काही data phishing-style card emails साठी reuse झाली.
- Arara ने service suspend केली, clients ना कळवलं आणि updated counts (~77M addresses, ~380 firms) प्रकाशित केल्या.
- Clients आणि end users ना सांगितलं की unexpected card emails suspicious समजा आणि official restart news ची वाट बघा.
3. हे कसं थांबवायचं / बचाव (हा lesson: strings, hashes, काळजीपूर्वक handling)
का: एक mail SaaS breach अशी phishing सोडू शकतो जी "official" दिसते कारण attacker कडे आधीच खरी address list असते.
तुम्ही वापरू शकता असे controls:
- Customer lists segment आणि encrypt करा; support staff ला full export नको, least privilege द्या.
- तुमच्या servers वर odd admin / mail restarts बघा (उदाहरण 1).
- Subscriber files कुठे आहेत ते inventory करा म्हणजे vendor alert नंतर काय freeze करायचं कळेल (उदाहरण 2).
- Staff ला forward करण्याआधी "official notice" sample hash आणि filetype-check करा (उदाहरण 3).
- Vendor IR clause: किती लवकर सांगतील, sends कसे थांबवतील, आणि customer notice कोणाची जबाबदारी.
- Users ना सांगा: outage दरम्यानचे Arara / card emails phishing आहेत जोपर्यंत तुमचा bank नाही म्हणत.
उदाहरण 1: तुमच्या auth log मध्ये अलीकडच्या mail-related admin actions शोधा.
- चालवा:
sudo grep -iE 'mail|smtp|sendgrid|ses' /var/log/auth.log | tail -n 5 - Output: जसं
Nov 1 03:12:08 mail sudo: admin : TTY=pts/0 ; USER=root ; COMMAND=/bin/systemctl restart postfix. - याचा अर्थ: कोणीतरी रात्री 3 वाजता root ने mail restart केलं – दुर्लक्ष करण्याआधी का ते विचारा.
उदाहरण 2: तुमच्या host वर subscriber export files शोधा.
- चालवा:
find /var/lib/mail-app -name '*.sql' -o -name 'subscribers*' 2>/dev/null | head - Output: जसं
/var/lib/mail-app/exports/subscribers-20261028.csv. - याचा अर्थ: पूर्ण list disk वर आहे. Permissions लॉक करा आणि laptops वर blind copies थांबवा.
उदाहरण 3: share करण्याआधी notice file चा fingerprint घ्या.
- चालवा:
sha256sum /tmp/notice-sample.txt 2>/dev/null; file /tmp/notice-sample.txt 2>/dev/null - Output: जसं
e3b0c44298fc1c14... /tmp/notice-sample.txt\n/tmp/notice-sample.txt: ASCII text. - याचा अर्थ: hash आणि साधा type मिळाला. Vendor च्या published sample शी compare करा; random .exe "notices" उघडू नका.
4. परत असं होऊ नये म्हणून काळजी (checklist)
- [ ] Mail-vendor contracts मध्ये breach notice time आणि send-kill switch लिहिलं आहे.
- [ ] Subscriber exports encrypted, access-logged आणि दुर्मिळ आहेत.
- [ ] Odd overnight mail admin actions खऱ्या माणसाला page करतात.
- [ ] Staff vendor notices फक्त email ने नाही तर hash / official URL ने verify करतात.
- [ ] Users ना "outage दरम्यान card mails दुर्लक्ष करा" असा one-line banner मिळतो.
- [ ] Restore नंतर vendor ने दिलेले SMTP आणि API keys rotate होतात.
स्रोत: Arara / Paycloud Holdings Japanese disclosure notice आणि updates, 2 नोव्हेंबर 2026; Jiji English, "77 M. Email Addresses Leak from Arara Message Due to Cyberattack"; The Japan Times, more Japan firm breaches including Arara, 3 नोव्हेंबर 2026; Nikkei xTECH / INTERNET Watch same-window reporting.
1. क्या हुआ
इस lesson में आपने सीखा कि strings, hashes और file types असली notice और junk अलग करने में मदद करते हैं – और एक बड़ा mail platform एक जगह लाखों addresses रखता है.
- 2 नवंबर 2026 को Japanese email-delivery company Arara (Paycloud Holdings subsidiary; product Arara Message) ने unauthorized access पर एक और notice प्रकाशित किया.
- उसने कहा कि करीब 97 client servers से करीब 77 million email addresses लिए गए हो सकते हैं, जिसका असर करीब 380 companies तक हो सकता है. Exposed fields में names, gender, birth dates, phones, membership IDs और addresses हो सकते हैं. उसने कहा उसके पास credit-card numbers नहीं थे.
- Attackers ने credit-card notices की नकल करते हुए करीब 7.13 million suspicious emails भी भेजे.
- Service 31 अक्टूबर 2026 को पूरी तरह suspend हुई और नवंबर की शुरुआत के notices में restart date नहीं थी. Japan Times और Jiji ने 2–3 नवंबर 2026 के आसपास यही disclosure window cover की.
2. हैक कैसे हुआ (सिर्फ़ सार्वजनिक जानकारी से – संक्षेप में)
- Arara Message कई client companies के लिए email-delivery data shared / client servers पर रखता था.
- Attackers को उन environments पर unauthorized access मिला (अंग्रेज़ी summaries में पहला दरवाज़ा पूरी तरह public नहीं).
- बड़ी subscriber / address lists copy हुईं; कुछ data phishing-style card emails के लिए reuse हुई.
- Arara ने service suspend की, clients को बताया और updated counts (~77M addresses, ~380 firms) प्रकाशित किए.
- Clients और end users से कहा गया कि unexpected card emails को suspicious मानें और official restart news का इंतज़ार करें.
3. इसे कैसे रोकें / बचाव (यह lesson: strings, hashes, सावधानी से handling)
क्यों: एक mail SaaS breach ऐसी phishing छोड़ सकता है जो "official" लगे क्योंकि attacker के पास पहले से असली address list होती है.
आप ये controls इस्तेमाल कर सकते हैं:
- Customer lists segment और encrypt करें; support staff को full export नहीं, least privilege दें.
- अपने servers पर odd admin / mail restarts देखें (उदाहरण 1).
- Subscriber files कहाँ हैं, inventory करें ताकि vendor alert के बाद क्या freeze करना है पता हो (उदाहरण 2).
- Staff को forward करने से पहले "official notice" sample को hash और filetype-check करें (उदाहरण 3).
- Vendor IR clause: कितनी जल्दी बताएँगे, sends कैसे रोकेंगे, और customer notice किसकी ज़िम्मेदारी.
- Users से कहें: outage के दौरान Arara / card emails phishing हैं जब तक आपका bank न कहे.
उदाहरण 1: अपने auth log में हाल की mail-related admin actions ढूँढें.
- चलाएँ:
sudo grep -iE 'mail|smtp|sendgrid|ses' /var/log/auth.log | tail -n 5 - Output: जैसे
Nov 1 03:12:08 mail sudo: admin : TTY=pts/0 ; USER=root ; COMMAND=/bin/systemctl restart postfix. - इसका मतलब: किसी ने रात 3 बजे root से mail restart किया – नज़रअंदाज़ करने से पहले पूछें क्यों.
उदाहरण 2: अपने host पर subscriber export files ढूँढें.
- चलाएँ:
find /var/lib/mail-app -name '*.sql' -o -name 'subscribers*' 2>/dev/null | head - Output: जैसे
/var/lib/mail-app/exports/subscribers-20261028.csv. - इसका मतलब: पूरी list disk पर है. Permissions लॉक करें और laptops पर blind copies रोकें.
उदाहरण 3: share करने से पहले notice file का fingerprint लें.
- चलाएँ:
sha256sum /tmp/notice-sample.txt 2>/dev/null; file /tmp/notice-sample.txt 2>/dev/null - Output: जैसे
e3b0c44298fc1c14... /tmp/notice-sample.txt\n/tmp/notice-sample.txt: ASCII text. - इसका मतलब: hash और सादा type मिला. Vendor के published sample से compare करें; random .exe "notices" न खोलें.
4. दोबारा ऐसा न हो, इसके लिए सावधानी (checklist)
- [ ] Mail-vendor contracts में breach notice time और send-kill switch लिखा है.
- [ ] Subscriber exports encrypted, access-logged और दुर्लभ हैं.
- [ ] Odd overnight mail admin actions असली इंसान को page करते हैं.
- [ ] Staff vendor notices सिर्फ़ email से नहीं, hash / official URL से verify करते हैं.
- [ ] Users को "outage के दौरान card mails नज़रअंदाज़ करें" वाला one-line banner मिलता है.
- [ ] Restore के बाद vendor द्वारा दिए SMTP और API keys rotate होते हैं.
स्रोत: Arara / Paycloud Holdings Japanese disclosure notice और updates, 2 नवंबर 2026; Jiji English, "77 M. Email Addresses Leak from Arara Message Due to Cyberattack"; The Japan Times, more Japan firm breaches including Arara, 3 नवंबर 2026; Nikkei xTECH / INTERNET Watch same-window reporting.
Ravindra Bagale's Tip
When your mail vendor is breached, assume the attacker already has the real address list. Suspend sends, verify notices by official URL or hash, and tell users that “card warning” emails during the outage are phishing.
Ravindra Bagale's Tip – मराठी
तुमचा mail vendor breach झाला तर समजा attacker कडे आधीच खरी address list आहे. Sends थांबवा, notices official URL किंवा hash ने verify करा, आणि users ना सांगा की outage दरम्यानचे "card warning" emails phishing आहेत.
Ravindra Bagale's Tip – हिंदी
आपका mail vendor breach हो तो मान लें attacker के पास पहले से असली address list है. Sends रोकें, notices official URL या hash से verify करें, और users से कहें कि outage के दौरान "card warning" emails phishing हैं.
Check if you're safe: Phishing Link Checker