pentesting, updated

Analyze web server access and error logs for attacker activity

Grep access/error logs for the request patterns that indicate scanning, fuzzing or exploitation.

Goal

Confirm whether, and how, a web application was attacked by reading its own request logs.

How to test

awk '{print $1}' access.log | sort | uniq -c | sort -rn | head   # noisiest source IPs
grep -E "union.*select|<script|\.\./\.\." access.log            # common injection/traversal strings
grep -E ' (4|5)[0-9]{2} ' access.log | awk '{print $7}' | sort | uniq -c | sort -rn  # failing paths
grep -iE 'curl|python-requests|sqlmap|nikto|dirbuster|ffuf' access.log  # scanner user-agents

For nginx/Apache error logs, grep for PHP fatal errors and stack traces that confirm an injected payload actually executed.

What to look for

A single IP hitting many distinct paths in seconds (fuzzing), repeated 500s on one endpoint right after a parameter changes shape, known scanner/tool user-agents, or a request containing a webshell filename right before a 200 on that same path.

Notes

Logs rotate — check /var/log/*/access.log.1, .gz archives and any centralized log shipper (ELK, Splunk) before concluding evidence does not exist.

References

§ home
~/knubertus/home/
1,1 Top