Monday, July 25, 2016

זמן ומוטיבציה

Time and Motivation

דמיינו את הסיטואציה הבאה: אתם נמצאים ללא אינטרנט, אבל מול עמדת מחשב.למשך לילה שלם. בערך פעם בשעה מצלצל הטלפון הקווי ואתם צריכים לעדכן טבלת אקסל ומשהו בתוכנה ייעודית כלשהי. בערך חמש דקות עבודה. מה תעשו עם שאר הזמן? אפשר להביא ספר, אבל למי יש כוח לקרוא באמצע הלילה?
אי אז מזמן, בטרם היות הטלפונים החכמים, הייתה רק תשובה אחת - משחקים סוליטייר, או שולה מוקשים.
לא מזמן, הודות לצה"ל, מצאתי את עצמי בסיטואציה כזו - מול עמדת מחשב מנותקת מכל דבר שמזכיר אינטרנט (בסך הכל - מערכות צבאיות הן לא משהו שאנחנו רוצים שידלוף החוצה), בלי פלאפון ומחכה שמשהו מעניין יקרה. כדי להוסיף חטא על פשע, המחשב הוגדר כך שהמשתמש שניתן לי היה בעל הרשאות מוגבלות למדי - כל מה שאפשר לפתוח הוא התוכנה הצבאית ומגוון תוכנות אופיס. זהו.
כדי להילחם בשיעמום נקטתי בגישה בה נתקלתי אי אז אצל ג'יימס באך - "אני יודע מה זה, המחשב הזה הוא תחנת אימונים לבודקי תוכנה!". פתאום יש לי מה לעשות. האתגר שבחרתי לעצמי - האם ניתן לעקוף את המגבלות שהוטלו על המשתמש שלי ולעשות דברים מעניינים יותר?
התשובה, בקיצור, היא "כן" (אחרת לא היה לי מה לכתוב). בערך אחרי שעה מצאתי את פריצת הדרך הראשונה שהובילה לכך שהיה לי ממשק של powershell פתוח על המחשב, עם גישה לכל מיני קבצים שאין אליהם גישה דרך הממשק הגרפי. לכאורה - ניצחתי, לא? הוכחתי שניתן לעקוף את מערכת ההרשאות עד מידה מסויימת. אבל כמו שהזכרתי קודם - היה לי משעמם, ורציתי לעשות משהו. ביליתי קצת זמן בלנסות להבין את מימדי הנזק שאני יכול לגרום (כמובן, בלי לגרום נזק של ממש - זו לא הייתה המטרה שלי), ואחרי ששכנעתי את עצמי שאני יכול לנסות להפיל את העמדה שלי ע"י מילוי הכונן הקשיח, או לנסות להציף את הרשת בבקשות PING ברשת הפנימית הצבתי לעצמי אתגר מעניין יותר - האם אני יכול להפעיל סוליטייר על המחשב? אני באמת לא בטוח מתי בדיוק הידע הזה נכנס לי לראש, אבל זכרתי שההתקנה הסטנדרטית של סוליטייר נמצאת תחת system32 (בחלונות XP) ולכן גיליתי די מהר שהמשחק לא מותקן.
חבל מאוד. כאן הגעתי לגבול הידע שלי, והמשכתי להעביר את הזמן במשמרת
אחרי המשמרת שלי, ניצלתי את האינטרנט בפלאפון כדי לשאול "איך להתקין סוליטייר משורת הפקודה?" מסתבר שזה ממש פשוט. במשמרת הבאה כבר שיחקתי בסוליטייר.
בסיכומו של עניין, בתוך מספר מועט של שעות (פחות משלוש שעות עבודה נטו, כולל חיפושים באינטרנט בפלאפון שנעשו הרחק מהמחשב) הצלחתי להגיע לקבצים שלא הייתי מורשה לראות, ידעתי לומר שההגנה על הregistry נאכפת היטב, מצאתי דרך להריץ קוד על המחשב ודרך נוחה למדי לכתוב אותו, והצלחתי "להתקין" משחקים (שכבר היו מכווצים על המחשב - לא חיברתי שום דבר שהגיע מחוץ לרשת המאובטחת). עשיתי את כל זה למרות שבתחילת הדרך ביליתי כשעה בניסיונות סרק שלא הובילו אותי לשום מקום. למה המשכתי? כי היה לי זמן לשרוף, וכי שיעמום הוא מניע חזק - אני רציתי סוליטייר, ועד שלא הגעתי למטרה שלי, לא עצרתי. מסתבר שעקשנות, התמדה או איך שלא תרצו לקרוא לזה, היא כלי חזק להחריד.
עכשיו נשארו רק שני דברים לעשות - למצוא מישהו שאני יכול לדווח לו על חולשות האבטחה במערכת, ולהבין איך אני מתרגם את דפוס ההתנהגות הזה לעבודה היומיומית.

-------------------------------
Imagine the following situation: You are sitting in front of a computer, with no access to internet at all, for a whole night. Once an hour, or so, the phone rings, and you have to update something on an excel sheet and another on a custom management system. All in all, a phone calls takes 5 minutes to handle. 10 if you try to stretch it. What would you do with the rest of the time you have? Perhaps you would bring a book, but frankly - reading at the middle of night can be taxing. There was a time, before smartphones, where the most common answer to such a situation was "Solitaire" (or minesweeper).
Not long ago, at the courtesy of the IDF, I found myself in such a situation during reserve duty. Naturally, I won't go into details, but I think that without breaking any rules or exposing classified information, I can safely say that I found myself in a similar situation. A lot of dead time in front of a computer with an occasional interruption every now and then. No internet, phones are not allowed (since they can be used for remote eavesdropping) and nothing really interesting to do. Worse: I was using the computer with an underprivileged account that enabled me access only to what was necessary to do the work I was called to do - A dedicated piece of software and a couple of office programs. Bummer.
So, to fight boredom off, I took an approach I saw at one of James Bach's videos - "I know what this is. This is a tester workout station".Suddenly, I had something to do. The challenge I chose for myself (or my charter, if you would prefer it), was to try and bypass the extreme limitation imposed on my user. Could I do something more interesting? The answer, by the way, is yes. I could (otherwise - nothing to write about, write?) It took me about an hour to get my first breakthrough that gave me a powershell interface.  Regular DOS was blocked for my user, so opening powershell was definitly something I was not supposed to do. In addition, Through powershell, I could access files that I was not able to access through the GUI.
As it seemed - victory was mine, right? opening a shell is usually refereed to as the hacker's end-game. But, as I have mentioned, I was bored, and thus I started looking around to see how extensive can I damage the system (with the obvious limitation of not actually wanting to do any damage, or any noise that might be noticed from the outside). I have convinced myself that I could, in theory, flood the internal network in ping requests, learned a bit about the underlying technologies used in the software installed on this computer and then went looking for solitaire under system32. Sadly, it wasn't there, and I concluded this shift.
During my off time, away from any sensitive data, I used my phone to google out some instructions and found out that I could actually install (or rather, extract) solitaire manually without doing something I know was monitored such as plugging in a USB drive (besides, if you ever work on a sensitive system, don't insert any media that was in contact with the outside world, you might end up with stuxnet). Thus, 10 minutes after my next shift, I got to play solitaire & minesweeper.

What really got my attention, except for the fact that in less than 3 hours of work with very limited resources, I knew quite a bit more about a system than I was supposed to (for instance, I know that the registry was write protected properly, but I could read the entire tree, which could have been helpful to an attacker familiar with the registry), was that I managed to do so despite my first 30 minutes were terribly frustrating - everything I tried was either blocked or futile. In a normal situation, I would have probably gone to check other things and say "this is safe enough". This time, as I had both plenty of time and motivation (boredom is almost a strong motivator as laziness), I just went on and on until something gave in. Persistence seems to be quite a strong tool.
Now, i have to do two things - find someone to report this bug to, and figure out how to translate this work pattern to my daily job.