Skip to content
Info disclosure Write-up Beginner

Power Of Recon Easy Win Vim Attack

A publicly accessible Vim swap file for wp-config.php was left on the server, which could expose the editor's username and potentially database credentials if the file was being edited. An attacker could download the swap file and recover sensitive configuration data.

Veshraj Ghimire Follow

Published on infosecwriteups.com

Hello there, I am Veshraj Ghimire all the way from Nepal. This is my second write up and in this write up, I am going to tell you one of my totally unexpected bounty story which was possible by recon only.

Veshraj Ghimire, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the server was misconfigured to allow public access to Vim swap files created in the web root, and the administrator edited wp-config.php directly on the live server without changing Vim's default swap file location.

Impact

An attacker could obtain the editor's username and potentially database credentials if the file was being edited, though the report notes this is not a big deal and requires the administrator to be actively editing the file.

What the attacker needed

Administrator edits wp-config.php with Vim; swap file left in public directory; attacker can access the swap file URL

The fix

The swap file should be removed from the public directory and Vim's swap file location should be changed to a non-public directory.

How it was found

  1. Fuzz the main domain with ffuf using a wordlist to discover hidden files.
  2. Find the publicly accessible file /wp-config.swp.
  3. Download the file and open it to see editor name, version, root and username.
  4. Set up a script to repeatedly download the swap file to catch it while the file is being edited.
  5. Run vim -r on the downloaded swap file to recover the file contents.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you edit a file with the Vim text editor, it creates a temporary backup file called a swap file. If that swap file is left in a public folder on a website, anyone can download it and see what was being edited, which might include passwords or usernames.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Veshraj Ghimire

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.