The front door has a map on it
Before anyone tries a lock, they read the building's signs. Which door is for staff? Is there a back way in?
A college web site often says more than its owners meant. A tester reads it first, slowly, and writes everything down.
The one rule
Warning
Gather from your own lab copy only. On a real test, reading public pages is allowed, but touching a host needs it in the written scope. In the UK, access without permission can be a crime under the Computer Misuse Act 1990.
Quick check: the rule
Have a go
Quick check: the rule
3 questionsBy the end of this lesson
Note
I can gather what a target shows the public and record it as notes.
Key words
| Word | What it means | Example |
|---|---|---|
| Reconnaissance | gathering facts about a target before testing it | |
| Passive | reading what is published, without touching the target | |
| Active | sending requests to the target itself | |
| OSINT | facts from open, public sources | |
| Banner | what a service says about itself | Server: Apache/2.4.49 |
The cells students fill in are left blank in this preview.
Starter
Have a go
Starter
4 questionsPassive first, then active
On a real test, passive reconnaissance comes first: public DNS records, certificate logs, job adverts and the client's own site. None of it touches the target.
Active reconnaissance sends requests to the target. The lab has no internet, so the college's public site stands in for both: read it as any visitor would.
Read the home page
curl -s http://www:8080/Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Follow the staff link
curl -s http://www:8080/staff/Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Check
Have a go
Check
3 questionsrobots.txt is a signpost, not a lock
robots.txt asks search engines to keep away from some paths. It cannot stop a visitor, and it tells everyone where the interesting paths are.
The headers come before the page. -I asks for the headers alone, and the Server header is the site's banner.
Read robots.txt
curl -s http://www:8080/robots.txtShown here, not run. Press Start lab to type it into your own lab’s terminal.
Read the headers alone
curl -sI http://www:8080/Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Check
Have a go
Check
3 questionsA common mistake
Warning
Many people think a banner tells you what is really running. A banner is only what the service chooses to say, and it can be wrong or old. Write it down as a claim, and check it before you rely on it. Lesson 4 checks this one.
Notes keep the test honest
Each note says what you learnt, where from, and whether it is in scope. A note without a source cannot go in a report.
Anything outside the scope is written down and left alone. Run the notes below.
Try it: recon notes with their sources
# Recon notes: each fact, where it came from, and whether it is in scope.
scope = ["www", "intranet", "cache"]
notes = [
("intranet", "staff page link"),
("/backup/", "robots.txt"),
("Apache 2.4.49", "Server header"),
]
for fact, source in notes:
host = fact if fact.isalpha() else "www"
print(fact, "| from", source, "| in scope:", host in scope)
# Add ("printer", "home page") to notes. What does it print?
Make a free account to save your work and track your progress.
How a defender sees reconnaissance
Every request you sent is a line in the site's log, with your address and the path. A request for robots.txt followed by its hidden paths is a pattern a defender can alert on.
The fixes are small: keep sensitive files off the server, not just out of robots.txt, and stop the header naming a version.
Read the site's log, without its health checks
docker logs www 2>&1 | grep -v 127.0.0.1Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Check nothing reached the supplier
docker logs hrShown here, not run. Press Start lab to type it into your own lab’s terminal.
Assignment: sort recon notes by scope
Recon text holds host names in two shapes: in a web address such as http://intranet:8000/, and as name:port such as cache:6379. Write two functions.
hosts_in(text) returns the host names found in the text, lower case, each once, sorted. A host name is letters, digits, dots and hyphens; take it from after :// up to the next : or /, and from before : and a port number. sort_hosts(names, scope) returns {"in": [...], "out": [...], "unknown": [...]}, each list sorted: a name in scope["exclude"] is out, a name in scope["hosts"] is in, any other is unknown.
def hosts_in(text):
return []
def sort_hosts(names, scope):
return {"in": [], "out": [], "unknown": []}
Make a free account to save your work and track your progress.
Exit quiz
Have a go