Update: You may also want to look at: تحديث : يمكنك ايضا ان ننظر في : MySpace Hack: How To View Any Users Private Videos ميسباكي المأجور : كيف لمشاهدة اشرطه الفيديو الخاصة لاي من المستخدمين .

Recently مؤخرا Samy سامي [samy at namb dot la] released a worm ["Samy worm" or "JS.Spacehero worm"] in MySpace, popular social networking platform like Friendster, which caused him to be added as hero to millions of MySpace users (”but most of all, samy is my hero.”) as well as add him as their friend, all without their explicit permission. [سامي في مدينة لوس انجلوس namb نقطة] سراح دودة] "سامي دودة" او "الدوده js.spacehero"] في ميسباكي الشعبية واقامة الشبكات الاجتماعية مثل منهاج friendster ، مما دفعه الى ان تضاف الى بطل ميسباكي الملايين من المستخدمين ( "ولكن معظم قبل كل شيء ، سامي هو بطل بلدي ".) فضلا عن اضافة لها صديق له ، جميع دون اذن صريح.

After flooding the Network, MySpace stepped in and fixed the hole. بعد الفيضانات الشبكه ، ميسباكي تكثيف والثابتة في ثقب. Samy is still “hero” to millions of MySpace users in their profile. سامي لا يزال "بطل" للملايين من مستخدمي ميسباكي في لمحة.

The purpose of this article is to highlight the security issues exposed by this worm. الغرض من هذه المادة هو تسليط الضوء على القضايا الامنية التي كشفت عنها هذه الدوده. It is definitely not limited to MySpace alone and the worm propagated not due to MySpace’s fault but fault of browser like Internet Explorer. ومن المؤكد ان لا تقتصر على وحدة المساحه الخاصة بي والدوده الدعايه ميسباكي لا يرجع الى خطأ ولكن خطأ من مثل متصفح انترنت اكسبلورر. And the flaw is waiting to be exploited in several other web applications of similar nature like Ryze or LinkedIn etc.. والعيب هو في انتظار أن تستغل في العديد من التطبيقات الشبكيه الاخرى ذات الطبيعة المماثله مثل ryze او linkedin الخ. In the remainder of this article I will summarize the modus-operandi of his script and suggest on ways to protect your web application against such attacks. في ما تبقى من هذه المادة سالخص - طريقة عمل له وكتابتها واقترح على وسائل حمايه لتطبيق الويب الخاص بك ضد مثل هذه الهجمات.

Samy used AJAX to add himself as a friend and hero when users visited his page. سامي اجاكس تستخدم لاضافة نفسه صديقا لبطل وعندما يقوم المستخدمون بزياره بلدة الصفحه. This requires Javascript to be executed in the browser which does the dirty work. وهذا يتطلب جافا سكريبت لتنفذ في متصفح القذره التي لا عمل.

MySpace dutifully eliminates javascript from users html (which becomes their profile). ميسباكي الواجب يقضي على جافا سكريبت من مستخدمي لغة تأشير النص الفائق) التي اصبحت بروفايلهم). However Sammy disguised the word javascript with an embedded newline - “java\nscript”. ولكن سامي المقنعه كلمة جافا سكريبت مع جزءا لا يتجزأ من سطر جديد -- "جافا \ nscript".

MySpace doesn’t allow script tags. ميسباكي لا يسمح سكريبت العلامات. So he embedded his javascript in CSS - style=”background:url(’javascript:eval(document.all.mycode.expr)’)” لذلك فهو جزءا لا يتجزأ من بلدة جافا سكريبت في CSS -- اسلوب = "معلومات اساسية : العنوان (' جافا سكريبت : مييقتلا هدحو (document.all.mycode.expr) ')"

AJAX can fetch documents from the same domain (or sub-domain) only. اجاكس يمكن احضار وثائق من نفس النطاق (او نطاق فرعي) فقط. So if the user was on profile.myspace.com, he moved them to www.myspace.com which provides the same information but allows him to be added as a friend. حتى اذا كان المستخدم على profile.myspace.com ، انتقل منهم الى www.myspace.com التي تنص على نفس المعلومات ولكنه يسمح التي يمكن ان تضاف اليه كصديق.
if (location.hostname == 'profile.myspace.com') document.location = 'http://www.myspace.com' + location.pathname + location.search; اذا كانت الاجابه ب (location.hostname == 'profile.myspace.com') document.location = 'http://www.myspace.com' location.search + + location.pathname ؛

After overcoming a trvial hash issue he adds his code and “but most of all, samy is my hero.” text to users profile. وبعد التغلب على مسألة trvial البعثره ويضيف صاحب المدونه و"ولكن الاهم من ذلك ، سامي هو بطل بلدي". نص لمستخدمي. This causes the worm to propagate not only when users visit his site but also when they visit any of the infected users. وهذا يسبب لنشر الدوده ليس فقط عندما يقوم المستخدمون بزياره صاحب الموقع وانما ايضا عند زيارة أي من المصابين المستخدمين. Yes, simple exponential spreading. نعم ، مجرد نشر الاسيه.

Samy provides ويقدم سامي detailed notes and code for his exploit مذكرات تفصيليه للقانون واستغلال له after the exploit was filtered / stopped by MySpace. بعد ان تم استغلال التنقيه / المساحه الخاصة بي وقفه.

How can you protect your web application from such attacks? كيف يمكنك حمايه تطبيق الويب الخاص بك من مثل هذه الهجمات؟
First and foremost I assume you have filtering in place like MySpace did filtering scripts and javascript tags etc. However obviously that is not enough; not even close. اولا وقبل كل شيء انني افترض الترشيح لديك في مكان مثل ميسباكي لم الترشيح مخطوطات وجافا سكريبت علامات وما الى ذلك من الواضح ان هذا لا يكفي ، ولا حتى وثيقة.
Your filtering tags should be intelligent to recognize words separated by newlines as shown above. ترشيح العلامات الخاصة بك ينبغي ان تكون عبارة ذكية للاعتراف newlines يفصل بينهما كما هو مبين اعلاه.

Other users profile (or any html content) should be viewable only from a separate sub-domain. نبذة عن المستخدمين الآخرين (او أي لغة تأشير النص الفائق المحتوى) ينبغي ان تكون للعرض فقط من فرعي مستقل النطاق.

Any actions like adding a link, friend, connection etc. must be done from pages which can never contains any other users code. اي اجراءات مثل إضافة وصلة او صديق ، وما الصدد يجب ان يتم ذلك من الصفحات التي لا يمكن ابدا ان يتضمن اي قانون للمستخدمين الآخرين. If you provide a link while viewing others profile to add his as a friend then on clicking you take him to a separate page where the users gets to edit information about his friend and add him after confirmation. اذا كنت توفر الربط فيما استعرض نبذة عن الآخرين اضافة الى بلدة كصديق لكم ثم النقر على نقله الى صفحة منفصلة حيث يحصل على المستخدمين لتحرير معلومات عن صديقه واضيف عليه بعد تأكيد. This page should not contain any html content from the user being added. هذه الصفحه يجب ان لا يحتوي على اي لغة تأشير النص الفائق المحتوى من المستخدم حاليا.

In essence we need to captalize on AJAX security model which prevents code execution from different site. في جوهرها ونحن بحاجة الى captalize على اجاكس نموذج الامن الذي يحول دون تنفيذ القانون من موقع مختلف.