2. Ports and Protocols: SSH, HTTP, HTTPS, FTP/SFTP and DNS
2.5 FTP and SFTP
FTP juna protocol aahe – aajun kahi hosting companies vaprtat. Pan tyacha motha problem: username aani password clear text madhe jatat.
| Point | FTP | FTPS | SFTP |
|---|---|---|---|
| Port | 21 (control) + 20 or random (data) | 21/990 + data ports | 22 (runs over SSH) |
| Encryption | None | TLS | SSH |
| Firewall friendliness | Poor (extra data ports) | Poor | Good (one port) |
| Recommended? | No | Only if required | Yes |
sftp -i mykey.pem ec2-user@<PUBLIC_IP> # then: put file.txt, get file.txt, ls, bye
scp -i mykey.pem report.pdf ubuntu@<PUBLIC_IP>:~/
Why this matters for security
With Wireshark (Part 10) you will literally see an FTP password appear in the packet capture. Anonymous FTP login and old vulnerable FTP servers (Metasploitable 2 runs one) are classic lab targets. In real systems, replace FTP with SFTP/SCP over SSH.
Ravindra Bagale's Tip
Many students install vsftpd and open port 21 just to upload files to EC2. There's no need! SSH is already running – in WinSCP, FileZilla or MobaXterm choose the "SFTP" protocol, port 22, and give your key. One less open port means one less risk.
Ravindra Bagale's Tip – मराठी
बरेच students EC2 वर file upload करायला vsftpd install करतात आणि port 21 open करतात. गरज नाही! SSH आधीच चालू आहे – WinSCP, FileZilla किंवा MobaXterm मध्ये protocol "SFTP" निवडा, port 22, आणि तुमची key द्या. एक कमी port open, एक कमी धोका.
Ravindra Bagale's Tip – हिंदी
बहुत से students EC2 पर file upload करने के लिए vsftpd install करते हैं और port 21 open कर देते हैं. ज़रूरत नहीं! SSH पहले से चल रहा है – WinSCP, FileZilla या MobaXterm में protocol "SFTP" चुनो, port 22, और अपनी key दो. एक port कम खुला, एक ख़तरा कम.
Practice task
Connect to any Linux machine with sftp, upload a file, list it, download it back, and exit with bye.
Extended teaching notes
Why this lesson matters
Hardening is deleting unnecessary risk: fewer packages, fewer open ports, fewer privileged accounts, faster patches, better logs.
Hardening related services
[('SSH', 'Key auth, no root login, Fail2ban or equivalent, SG limited to your IP/VPN.', '', ''), ('SMB / NFS / LDAP / SNMP', 'Do not expose to the internet; patch; strong auth; disable unused versions (e.g. SMBv1).', '', ''), ('SMTP', 'Authenticated relay only; SPF/DKIM/DMARC for your domains.', '', ''), ('DNS', 'Restrict zone transfers; monitor for unexpected records (crt.sh for certs).', '', ''), ('Firewalls', 'Host firewall + cloud SG/NSG; default deny; document every allow.', '', '')]
Real examples
Global: CIS Benchmarks exist for Linux, Windows and clouds. Indian company (sample): a Pune team requires SSH keys only and weekly patch windows for internet-facing hosts.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.
Real incident: ETS (California state tests) – one stolen SFTP login used for four months to copy student records (Oct 2026)
1. What happened
Educational Testing Service (ETS) is a nonprofit testing organisation. Under a contract with the State of California, it runs the state tests for public school students. ETS used an SFTP site to send and receive test files with the California Department of Education (CDE).
- On 25 September 2026, ETS spotted unauthorized activity on that SFTP site. It disabled the account involved, took the site offline and started an investigation with outside security experts.
- The investigation found that someone used one compromised login credential to get into the SFTP site again and again between 22 May and 18 September 2026, and copied files with student information. That is almost four months before anyone noticed.
- The copied files cover, at least, all students enrolled in the previous three school years. The data can include student name, date of birth, home address, school, grade, student ID numbers, demographic details, disability and testing-accommodation details, and test results. No exact number of affected students has been published. (CDE's own figures show more than 5.7 million students in California public schools in the 2025–26 school year alone.)
- CDE says the files did not contain Social Security numbers, passwords, bank or card details, or parent information.
- Families started getting notices on 16 October 2026, and notices will go out until early November. ETS is giving two years of free identity protection, and it has built a completely new SFTP site with stronger security controls.
- The official notices do not say how the login was stolen and do not name the attacker. ETS says it has found no sign so far that the data was published online.
2. How the hack happened (public reporting only – high-level)
- ETS kept an SFTP site reachable from the internet, so that CDE and ETS could exchange large test-data files.
- The attacker got hold of one working username and login secret for that site. How they got it is not public.
- The attacker simply logged in like a normal user. SFTP encrypted the connection perfectly – but encryption only protects the data on the wire. It cannot tell a real user from a thief who has the right login.
- Over almost four months, the attacker came back at various times and copied the files that were on the site each time.
- The logins and downloads were not caught for months. The activity was found on 25 September, one week after the last known access.
3. How to stop it / defend (this lesson: FTP and SFTP)
- SFTP is the right protocol, but it is only the lock on the pipe. Choosing SFTP over FTP (this lesson) stops password sniffing. You still have to protect who can log in.
- Use SSH keys, not passwords, for SFTP accounts. Give each partner its own account and own key, never one shared login. Where your SFTP tool supports it, add MFA for human users.
- Allow port 22 only from known addresses. If only one partner office or server should connect, allow only its IP address in the security group or firewall (same idea as limiting SSH to your IP in 2.2).
- Lock each user into its own folder. Each SFTP user should see only its own folder, and only the rights it needs (for example upload-only for a sender).
- Don't use the transfer site as a storage room. Move files away after they are picked up and auto-delete old files. A stolen login is far less harmful when the site holds only today's files.
- Log every login and every download, and send the logs to a SIEM (Chapter 31). Alert on a login from a new country or IP, logins at odd hours, or one account downloading much more than usual.
4. How to take care so it won't happen again (checklist)
- [ ] List every FTP/SFTP server you run, who owns it, and every account on it.
- [ ] Remove old and unused accounts, and rotate keys and passwords on a schedule.
- [ ] Turn off password login for SFTP accounts where keys can be used; add MFA for people.
- [ ] Allow port 22 only from partner IP addresses that really need it.
- [ ] Set a short retention time on the transfer folders, and delete files once they are collected.
- [ ] Review SFTP login and download logs every week, and alert on unusual volume.
- [ ] If a vendor handles your data, ask in the contract for these same controls and for access logs.
Source: California Department of Education, "ETS Begins Notifying California Students and Families Following Data Security Incident", 16 October 2026; ETS Notice of Data Breach published by the California Department of Education (page reviewed 19 October 2026); SecurityWeek, "One Compromised Login Exposed Millions of California Students' Records", 19 October 2026; Malwarebytes, "Millions of California students' sensitive data stolen in breach", 19 October 2026.
1. काय झालं
Educational Testing Service (ETS) ही एक nonprofit testing संस्था आहे. State of California सोबतच्या contract खाली ती public school च्या students च्या state tests घेते. California Department of Education (CDE) सोबत test files पाठवायला आणि घ्यायला ETS एक SFTP site वापरत होती.
- 25 सप्टेंबर 2026 ला ETS ला त्या SFTP site वर unauthorized activity दिसली. त्यांनी ते account बंद केलं, site offline केली आणि बाहेरच्या security experts सोबत investigation सुरू केलं.
- Investigation मध्ये कळलं की कोणीतरी एक compromised login credential वापरून 22 मे ते 18 सप्टेंबर 2026 या काळात पुन्हा पुन्हा SFTP site मध्ये घुसलं, आणि students ची माहिती असलेल्या files copy केल्या. म्हणजे कोणाच्या लक्षात यायच्या आधी जवळपास चार महिने.
- Copy झालेल्या files मध्ये कमीत कमी मागच्या तीन school years मध्ये enrolled असलेले सगळे students येतात. Data मध्ये student चं नाव, जन्मतारीख, घरचा पत्ता, school, grade, student ID numbers, demographic माहिती, disability आणि testing-accommodation ची माहिती, आणि test results असू शकतात. नेमके किती students affected आहेत, हा आकडा जाहीर झालेला नाही. (CDE च्या स्वतःच्या आकड्यांनुसार फक्त 2025–26 school year मध्येच California च्या public schools मध्ये 5.7 million पेक्षा जास्त students होते.)
- CDE म्हणतं की files मध्ये Social Security numbers, passwords, bank किंवा card details, किंवा पालकांची माहिती नव्हती.
- Families ना 16 ऑक्टोबर 2026 पासून notices मिळायला सुरुवात झाली, आणि नोव्हेंबरच्या सुरुवातीपर्यंत notices जात राहतील. ETS दोन वर्षांचं free identity protection देत आहे, आणि त्यांनी मजबूत security controls असलेली पूर्णपणे नवीन SFTP site बनवली आहे.
- Official notices मध्ये login कसं चोरीला गेलं ते सांगितलेलं नाही, आणि attacker चं नावही नाही. ETS म्हणतं की data online publish झाल्याचं अजून तरी काही दिसलेलं नाही.
2. Hack कसा झाला (फक्त public reporting – high-level)
- CDE आणि ETS ला मोठ्या test-data files एकमेकांना देता याव्यात म्हणून ETS ने एक internet वरून reachable SFTP site ठेवली होती.
- Attacker च्या हाती त्या site चं एक चालू username आणि login secret लागलं. ते त्याला कसं मिळालं, हे public नाही.
- Attacker ने सरळ normal user सारखं login केलं. SFTP ने connection अगदी व्यवस्थित encrypt केलं – पण encryption फक्त wire वरच्या data ला वाचवतं. बरोबर login असलेल्या चोराला आणि खऱ्या user ला ते वेगळं ओळखू शकत नाही.
- जवळपास चार महिने attacker वेगवेगळ्या वेळी परत आला आणि प्रत्येक वेळी site वर असलेल्या files copy केल्या.
- हे logins आणि downloads महिनोन्महिने पकडले गेले नाहीत. Activity 25 सप्टेंबर ला सापडली, म्हणजे शेवटच्या माहीत असलेल्या access नंतर एका आठवड्याने.
3. कसं थांबवायचं / बचाव (हा lesson: FTP आणि SFTP)
- SFTP हाच बरोबर protocol आहे, पण तो फक्त pipe वरचं कुलूप आहे. FTP ऐवजी SFTP निवडलं (हा lesson) की password sniffing थांबतं. पण कोण login करू शकतं ते तुम्हालाच सांभाळायला लागतं.
- SFTP accounts साठी passwords नाही, SSH keys वापरा. प्रत्येक partner ला त्याचं स्वतःचं account आणि स्वतःची key द्या, एकच shared login कधीच नको. तुमच्या SFTP tool मध्ये सोय असेल तर माणसांसाठी MFA लावा.
- Port 22 फक्त ओळखीच्या addresses वरूनच allow करा. फक्त एका partner office किंवा server ने connect करायचं असेल, तर security group किंवा firewall मध्ये फक्त त्याचाच IP address allow करा (2.2 मध्ये SSH फक्त तुमच्या IP वरून allow केलं, तीच कल्पना).
- प्रत्येक user ला त्याच्याच folder मध्ये बंद करा. प्रत्येक SFTP user ला फक्त त्याचाच folder दिसावा, आणि जेवढे लागतात तेवढेच rights असावेत (उदा. पाठवणाऱ्यासाठी फक्त upload).
- Transfer site ला गोदाम बनवू नका. Files उचलल्या गेल्या की त्या दुसरीकडे हलवा आणि जुन्या files आपोआप delete होऊ द्या. Site वर फक्त आजच्या files असतील, तर चोरलेल्या login ने खूप कमी नुकसान होतं.
- प्रत्येक login आणि प्रत्येक download log करा, आणि logs SIEM कडे पाठवा (Chapter 31). नवीन देश किंवा IP वरून login, विचित्र वेळेचे logins, किंवा एका account ने नेहमीपेक्षा खूप जास्त download केलं, तर alert यायला हवा.
4. पुन्हा असं होऊ नये म्हणून काय काळजी घ्यायची (checklist)
- [ ] तुम्ही चालवता त्या प्रत्येक FTP/SFTP server ची list बनवा – त्याचा owner कोण, आणि त्यावरचं प्रत्येक account.
- [ ] जुने आणि न वापरलेले accounts काढून टाका, आणि keys आणि passwords ठरलेल्या वेळी बदला.
- [ ] जिथे keys वापरता येतात तिथे SFTP accounts चं password login बंद करा; माणसांसाठी MFA लावा.
- [ ] Port 22 फक्त ज्या partner IP addresses ना खरंच गरज आहे, त्यांनाच allow करा.
- [ ] Transfer folders वर कमी retention time ठेवा, आणि files उचलल्या की delete करा.
- [ ] SFTP login आणि download logs दर आठवड्याला review करा, आणि असामान्य volume वर alert ठेवा.
- [ ] एखादा vendor तुमचा data हाताळत असेल, तर contract मध्येच हेच controls आणि access logs मागा.
स्रोत: California Department of Education, "ETS Begins Notifying California Students and Families Following Data Security Incident", 16 ऑक्टोबर 2026; California Department of Education ने प्रसिद्ध केलेली ETS Notice of Data Breach (page 19 ऑक्टोबर 2026 ला reviewed); SecurityWeek, "One Compromised Login Exposed Millions of California Students' Records", 19 ऑक्टोबर 2026; Malwarebytes, "Millions of California students' sensitive data stolen in breach", 19 ऑक्टोबर 2026.
1. क्या हुआ
Educational Testing Service (ETS) एक nonprofit testing संस्था है. State of California के साथ contract के तहत यह public school के students के state tests करवाती है. California Department of Education (CDE) के साथ test files भेजने और लेने के लिए ETS एक SFTP site इस्तेमाल करती थी.
- 25 सितंबर 2026 को ETS को उस SFTP site पर unauthorized activity दिखी. उन्होंने वह account बंद किया, site को offline किया और बाहर के security experts के साथ investigation शुरू की.
- Investigation में पता चला कि किसी ने एक compromised login credential से 22 मई से 18 सितंबर 2026 के बीच बार-बार SFTP site में घुसकर students की जानकारी वाली files copy कीं. यानी किसी के ध्यान में आने से पहले लगभग चार महीने.
- Copy हुई files में कम से कम पिछले तीन school years में enrolled सभी students आते हैं. Data में student का नाम, जन्मतिथि, घर का पता, school, grade, student ID numbers, demographic जानकारी, disability और testing-accommodation की जानकारी, और test results हो सकते हैं. कितने students affected हैं, इसका सही आंकड़ा जारी नहीं हुआ है. (CDE के अपने आंकड़ों के मुताबिक़ सिर्फ़ 2025–26 school year में ही California के public schools में 5.7 million से ज़्यादा students थे.)
- CDE कहता है कि files में Social Security numbers, passwords, bank या card details, या माता-पिता की जानकारी नहीं थी.
- Families को 16 अक्टूबर 2026 से notices मिलने शुरू हुए, और नवंबर की शुरुआत तक notices जाते रहेंगे. ETS दो साल का free identity protection दे रही है, और उसने मज़बूत security controls वाली पूरी तरह नई SFTP site बनाई है.
- Official notices में यह नहीं बताया गया कि login कैसे चोरी हुआ, और attacker का नाम भी नहीं है. ETS कहती है कि अब तक data online publish होने का कोई सबूत नहीं मिला है.
2. Hack कैसे हुआ (सिर्फ़ public reporting – high-level)
- CDE और ETS बड़ी test-data files एक-दूसरे को दे सकें, इसके लिए ETS ने एक internet से reachable SFTP site रखी थी.
- Attacker के हाथ उस site का एक चालू username और login secret लग गया. उसे यह कैसे मिला, यह public नहीं है.
- Attacker ने सीधे normal user की तरह login किया. SFTP ने connection को बिल्कुल ठीक से encrypt किया – लेकिन encryption सिर्फ़ wire पर चल रहे data को बचाता है. सही login वाले चोर और असली user में यह फ़र्क़ नहीं कर सकता.
- लगभग चार महीने तक attacker अलग-अलग समय पर वापस आया और हर बार site पर मौजूद files copy कीं.
- ये logins और downloads महीनों तक पकड़े नहीं गए. Activity 25 सितंबर को मिली, यानी आख़िरी ज्ञात access के एक हफ़्ते बाद.
3. कैसे रोकें / बचाव (यह lesson: FTP और SFTP)
- SFTP ही सही protocol है, लेकिन यह सिर्फ़ pipe पर लगा ताला है. FTP की जगह SFTP चुनने से (यह lesson) password sniffing रुकती है. लेकिन कौन login कर सकता है, यह आपको ही संभालना होगा.
- SFTP accounts के लिए passwords नहीं, SSH keys इस्तेमाल करो. हर partner को उसका अपना account और अपनी key दो, एक shared login कभी नहीं. आपके SFTP tool में सुविधा हो तो इंसानों के लिए MFA लगाओ.
- Port 22 सिर्फ़ जाने-पहचाने addresses से ही allow करो. अगर सिर्फ़ एक partner office या server को connect करना है, तो security group या firewall में सिर्फ़ उसी का IP address allow करो (2.2 में SSH सिर्फ़ अपने IP से allow किया था, वही सोच).
- हर user को उसके अपने folder में बंद करो. हर SFTP user को सिर्फ़ उसका अपना folder दिखे, और सिर्फ़ उतने ही rights हों जितने ज़रूरी हैं (जैसे भेजने वाले के लिए सिर्फ़ upload).
- Transfer site को गोदाम मत बनाओ. Files उठा ली जाएँ तो उन्हें कहीं और ले जाओ और पुरानी files अपने आप delete होने दो. Site पर सिर्फ़ आज की files हों, तो चोरी हुए login से बहुत कम नुक़सान होता है.
- हर login और हर download log करो, और logs SIEM को भेजो (Chapter 31). नए देश या IP से login, अजीब समय के logins, या एक account का आम से बहुत ज़्यादा download करना – इन पर alert आना चाहिए.
4. दोबारा ऐसा न हो, इसके लिए क्या ध्यान रखें (checklist)
- [ ] आप जो भी FTP/SFTP server चलाते हो, उन सबकी list बनाओ – owner कौन है, और उस पर हर account.
- [ ] पुराने और बेकार accounts हटाओ, और keys और passwords तय समय पर बदलो.
- [ ] जहाँ keys इस्तेमाल हो सकती हैं, वहाँ SFTP accounts का password login बंद करो; इंसानों के लिए MFA लगाओ.
- [ ] Port 22 सिर्फ़ उन्हीं partner IP addresses को allow करो जिन्हें सच में ज़रूरत है.
- [ ] Transfer folders पर कम retention time रखो, और files उठ जाने पर delete करो.
- [ ] SFTP login और download logs हर हफ़्ते review करो, और असामान्य volume पर alert रखो.
- [ ] अगर कोई vendor आपका data संभालता है, तो contract में ही यही controls और access logs माँगो.
स्रोत: California Department of Education, "ETS Begins Notifying California Students and Families Following Data Security Incident", 16 अक्टूबर 2026; California Department of Education द्वारा प्रकाशित ETS Notice of Data Breach (page 19 अक्टूबर 2026 को reviewed); SecurityWeek, "One Compromised Login Exposed Millions of California Students' Records", 19 अक्टूबर 2026; Malwarebytes, "Millions of California students' sensitive data stolen in breach", 19 अक्टूबर 2026.
Check if you're safe: Password Strength Checker