{
    "id": "96bc3d49-f817-4126-ad31-f1c35ae64487",
    "name": "File Carving & Creating Custom Signatures",
    "slug": "file-carving-creating-custom-signatures",
    "status": "published",
    "lab_type": "pta",
    "is_sample": false,
    "duration_in_seconds": 1800,
    "metadata": {
        "courses": [
            "225b7429-bd2e-433e-9168-318d861e97cf"
        ],
        "pta_sdn": "58",
        "pta_namespace": "my.ine",
        "learning_paths": [],
        "has_published_parent": true
    },
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2022-03-30T02:55:31.124986Z",
    "modified": "2024-04-30T14:31:27.853978Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": "3e1aa06f-2e9f-4789-b50d-aa027ad8dcfa",
    "learning_areas": [
        {
            "id": "3e1aa06f-2e9f-4789-b50d-aa027ad8dcfa",
            "name": "Cyber Security",
            "slug": "cyber-security"
        }
    ],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": false,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "external_url": "",
    "solution_video": null,
    "explanation_video": null,
    "description": "# Scenario\n\nIn these exercises, you will use a couple of file carving tools to carve different files from corrupted file systems or forensic images.\n\nEvidence given: FormattedDrive.001 [located at **~/Desktop/Module5/Lab13**].\n\n# Goals\n\n-   Carve different files from corrupted systems\n\n-   Practice file carving using different tools\n\n# What you will learn\n\n-   How to perform file carving using popular file carving tools\n\n-   Data can still be retrieved and carved out if it hasn't been overwritten\n\n-   How to write custom signatures to carve a specific file of interest\n\n# Recommended tools\n\n-   **PhotoRec**\n\n-   **Foremost**\n\n-   **Scalpel**\n\n-   **Bulk_extractor**",
    "description_html": "<h1>Scenario</h1>\n<p>In these exercises, you will use a couple of file carving tools to carve different files from corrupted file systems or forensic images.</p>\n<p>Evidence given: FormattedDrive.001 [located at <strong>~/Desktop/Module5/Lab13</strong>].</p>\n<h1>Goals</h1>\n<ul>\n<li>\n<p>Carve different files from corrupted systems</p>\n</li>\n<li>\n<p>Practice file carving using different tools</p>\n</li>\n</ul>\n<h1>What you will learn</h1>\n<ul>\n<li>\n<p>How to perform file carving using popular file carving tools</p>\n</li>\n<li>\n<p>Data can still be retrieved and carved out if it hasn't been overwritten</p>\n</li>\n<li>\n<p>How to write custom signatures to carve a specific file of interest</p>\n</li>\n</ul>\n<h1>Recommended tools</h1>\n<ul>\n<li>\n<p><strong>PhotoRec</strong></p>\n</li>\n<li>\n<p><strong>Foremost</strong></p>\n</li>\n<li>\n<p><strong>Scalpel</strong></p>\n</li>\n<li>\n<p><strong>Bulk_extractor</strong></p>\n</li>\n</ul>",
    "tasks": "# Tasks\n\n## Task 1: File Carving using PhotoRec\n\nUsing the PhotoRec tool, try to carve files out of the given evidence [located at **~/Desktop/Module5/Lab13/FormattedDrive.001**], and answer the following questions:\n\n1.  How many files in total did you manage to carve?\n2.  How many pictures can you manage to carve?\n3.  Did you find any suspicious pictures or they were just ordinary pictures?\n4.  Did you find any other files? What are they?\n5.  Did you manage to open the other files you extracted, and why?\n6.  How can you identify the 7zip file using its header to verify that it is truly a 7zip file?\n7.  Did you manage to open the 7zip file? How did you do it, and what was written in this report?\n\n\n\n**Important note**: If you receive a \"Failed to recv data from socket\" error while trying to browse/view the file that PhotoRec carved, please follow the approach below.\n\n- Double click the Lab13 folder on Desktop\n- Right click inside the Lab13 folder and select Open Terminal Here\n- Execute photorec (photorec FormattedDrive.001). Don't use the sudo option!!!\n- Once it finishes a directory named **recup_dir.1** will be created inside the Lab13 folder. You will be able to double click it and browse all PNGs (the pdf and the report will most probably create the error you mentioned if double-clicked). Use the cat command inside the terminal in order to browse the report if you want.\n\n## Task 2: File Carving using Foremost\n\nYou are required to analyze the same evidence we used in Task 1 but this time using the Foremost tool to check if we can carve files that were not found when we used PhotoRec. After running the tool:\n\n1.  What did you find? Do you have an idea why?\n\n2.  Update the foremost configuration file in order to carve specific files.\n\n3.  Could you tell what type of files is foremost searching for by default?\n\n4.  What must be done to locate JPG files for example?\n\n5.  After completing the tests on both forensic images, which do you think was more successful than the other? Does such opinion lead you to a conclusion?\n\n## Task 3: File Carving using Scalpel\n\nWe will continue working with the same forensic image files as before, but this time with a new tool called Scalpel. Please make sure you use the custom \"scalpel.conf\" file provided.\n\nAfter completing the analysis of both evidence:\n\n1.  Did scalpel manage to achieve carving the same number of files?\n\n2.  What was missing, and what must be done to correct that?\n\n## Task 4: Defining New File Signatures for PhotoRec\n\nIn this part of the lab, we want to prepare PhotoRec for a future task. PhotoRec by default is not able to extract Windows Prefetch files (don't ask what are they yet, that will come soon). In order to get PhotoRec equipped with such capabilities, we need to write our own signatures.\n\n## Task 5: Using Bulk_extractor to Extract Data\n\nbulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. The results can be easily inspected, parsed, or processed with automated tools. More info: http://www.forensicswiki.org/wiki/Bulk_extractor and https://github.com/simsong/bulk_extractor/",
    "tasks_html": "<h1>Tasks</h1>\n<h2>Task 1: File Carving using PhotoRec</h2>\n<p>Using the PhotoRec tool, try to carve files out of the given evidence [located at <strong>~/Desktop/Module5/Lab13/FormattedDrive.001</strong>], and answer the following questions:</p>\n<ol>\n<li>How many files in total did you manage to carve?</li>\n<li>How many pictures can you manage to carve?</li>\n<li>Did you find any suspicious pictures or they were just ordinary pictures?</li>\n<li>Did you find any other files? What are they?</li>\n<li>Did you manage to open the other files you extracted, and why?</li>\n<li>How can you identify the 7zip file using its header to verify that it is truly a 7zip file?</li>\n<li>Did you manage to open the 7zip file? How did you do it, and what was written in this report?</li>\n</ol>\n<p><strong>Important note</strong>: If you receive a \"Failed to recv data from socket\" error while trying to browse/view the file that PhotoRec carved, please follow the approach below.</p>\n<ul>\n<li>Double click the Lab13 folder on Desktop</li>\n<li>Right click inside the Lab13 folder and select Open Terminal Here</li>\n<li>Execute photorec (photorec FormattedDrive.001). Don't use the sudo option!!!</li>\n<li>Once it finishes a directory named <strong>recup_dir.1</strong> will be created inside the Lab13 folder. You will be able to double click it and browse all PNGs (the pdf and the report will most probably create the error you mentioned if double-clicked). Use the cat command inside the terminal in order to browse the report if you want.</li>\n</ul>\n<h2>Task 2: File Carving using Foremost</h2>\n<p>You are required to analyze the same evidence we used in Task 1 but this time using the Foremost tool to check if we can carve files that were not found when we used PhotoRec. After running the tool:</p>\n<ol>\n<li>\n<p>What did you find? Do you have an idea why?</p>\n</li>\n<li>\n<p>Update the foremost configuration file in order to carve specific files.</p>\n</li>\n<li>\n<p>Could you tell what type of files is foremost searching for by default?</p>\n</li>\n<li>\n<p>What must be done to locate JPG files for example?</p>\n</li>\n<li>\n<p>After completing the tests on both forensic images, which do you think was more successful than the other? Does such opinion lead you to a conclusion?</p>\n</li>\n</ol>\n<h2>Task 3: File Carving using Scalpel</h2>\n<p>We will continue working with the same forensic image files as before, but this time with a new tool called Scalpel. Please make sure you use the custom \"scalpel.conf\" file provided.</p>\n<p>After completing the analysis of both evidence:</p>\n<ol>\n<li>\n<p>Did scalpel manage to achieve carving the same number of files?</p>\n</li>\n<li>\n<p>What was missing, and what must be done to correct that?</p>\n</li>\n</ol>\n<h2>Task 4: Defining New File Signatures for PhotoRec</h2>\n<p>In this part of the lab, we want to prepare PhotoRec for a future task. PhotoRec by default is not able to extract Windows Prefetch files (don't ask what are they yet, that will come soon). In order to get PhotoRec equipped with such capabilities, we need to write our own signatures.</p>\n<h2>Task 5: Using Bulk_extractor to Extract Data</h2>\n<p>bulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. The results can be easily inspected, parsed, or processed with automated tools. More info: http://www.forensicswiki.org/wiki/Bulk_extractor and https://github.com/simsong/bulk_extractor/</p>",
    "published_date": "2020-10-20T15:32:26Z",
    "solutions": "# SOLUTIONS\n\n## Task 1: File Carving using PhotoRec\n\nLet's start by using PhotoRec in order to answer the required questions. We can do that easily by doing the following:\n\n```\n# cd Desktop/Module5/Lab13\n# photorec FormattedDrive.001\n```\n\nWith that we reach the welcome message or banner of PhotoRec with some basic information about the tool, as you can see in the figure below:\n\n![1](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/1.png)\n\nWe can proceed, so just press **Enter** while the cursor has selected **[Proceed]**.\n\nAfter doing that, we reach the following:\n\n![2](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/2.png)\n\nIn this window, we need to select the file system or disk that we want to start carving files from. Now, in our case here, we have an NTFS partition and an entry for the whole disk. Since there could be evidence in other places other than the file system, let's select **[Whole disk]** and then press the **[Search]** button to proceed.\n\nNow, PhotoRec requires that we select the file system type that is being used, so make sure that **[Other]** is selected and then press **Enter**.\n\n![3](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/3.png)\n\nNow, PhotoRec is asking you where to store the files that it will be carving; for this lab, you can leave the first selection (the **.** dot, to store in the same directory) and then press **C** to continue.\n\nAfter PhotoRec is finished, it will give you a summary of the number of files that have been carved and the location that was used to store them, as seen below:\n\n![4](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/4.png)\n\nAfter that, press the **[ QUIT ]** button, then go to the **[ QUIT ]** button again to exit this window, then finally another **[ QUIT ]** to exit PhotoRec. You can use the arrows to navigate through the menu.\n\nSo now we are ready to answer the questions:\n\n1.  How many pictures can you manage to carve?\n\n    **[Answer:]**\n\n    PhotoRec found 10 files.\n\n    We can check the report generated, that is named report.xml.\n\n2.  Did you find any suspicious pictures or were they ordinary pictures?\n\n    **[Answer:]** \n    Pictures of Mr.Robot and hacking stuff were found.\n\n3.  Did you find any other files? What are they?\n\n    **[Answer:]**\n\n    Yes, I found a PDF File about Hacking, a couple of EXE files (Putty, PSFTP, and PSCP), also a 7zip file.\n\n4.  Did you manage to open the other files you extracted, and why?\n\n    **[Answer:]**\n\n    Yes, except the 7zip file, because it was password protected.\n\n5.  How can you identify the 7zip file using its header to verify that it is truly a 7zip file?\n\n    **[Answer:]**\n\n    We can use the following (note: change file.7z to the name of the carved file on your system):\n\n    ```\n    # xxd file.7z | head -n20\n    ```\n\n    Using GaryKessler's file signature database online, we can prove that it truly is for a 7zip file. You can find the database at:    https://www.garykessler.net/library/file_sigs.html\n\n6.  Did you manage to open the 7zip file? How did you do it, and what     was written in this report?\n\n    **[Answer:]**\n\n    Yes, while checking the photos available, we found a photo that had the following password written in it: Dylan_2791\n\n    People tend to use such techniques to remember their passwords. So, after trying the password found, we managed to open the file and reach the content inside. We found the following text:\n\n    ```\n    Mr.Robot Plan:\n    1. Hack first machine\n    2. Hack second machine\n    3. Hack third machine\n    4. Send SMS to +0018455550\n    5. Solve the riddle :D\n    6. Keep hacking until there is no machines :D\n    Plan is to invade computers and keep hacking...\n    ```\n    ![5](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/5.png)\n\n## Task 2: File Carving using Foremost\n\nIn this task, we need to use Foremost instead of PhotoRec to see what differences can be found if any. To run the tool against our evidence, we need to do the following:\n\n```\n# cd Desktop/Module5/Lab13\n# foremost -T FormattedDrive.001\n```\n\nNow let's answer the questions below:\n\n1.  What did you find? Do you have an idea why? (Hint: Do an ls and explore)\n\n    **[Answer:]**\n    \n    We found that foremost carved a couple of files and created a subdirectory for each type. Also, it created a text file named **audit.txt** with         details of what was done, which was stored by default in a directory named **output_DATE_TIME**. By checking the audit.txt report in that folder, we found that foremost managed to find only 9 files.\n\n2.  Update the foremost configuration file in order to carve specific files (PNG and PDF).\n\n    **[Answer:]**\n    \n    What we need to do here is edit the **foremost.conf** configuration file and make sure we comment out the lines referring to PNG and PDF, which can be done like this:\n\n    ```\n    # vi /etc/foremost.conf\n    ```\n    Then search for the line below:\n    ```\n    #     png     y     200000 \\x50\\x4e\\x47?    \\xff\\xfc\\xfd\\xfe\n    ```\n   \n    And make sure you remove the **#** from the beginning of the line containing the file signature. Do the same for PDF, and after you finish press **Esc**, then **:x** (yes colon + x).\n\n    Now if we run the command again like we did before, it will generate a directory with another directory with a new time stamp.\n\n    This time four files were found: 3 PNG files and 1 PDF file.\n\n3.  Could you tell what type of files foremost was searching for by default?\n\n    **[Answer:]**\n\n    From the man page of foremost, it says that it runs all pre-defined extraction methods. Most files are already built into foremost and can be carved out automatically. The configuration file is used to control or add other file formats that are not already defined by foremost.\n\n4.  What must be done to locate JPG files for example?\n\n    **[Answer:]** \n\n    Foremost is supposed to be able to carve them out automatically, but if you have specific configurations or want to make sure all variations, for example, are checked, then make sure you add and comment out the lines below from the foremost.conf file: \n    ```\n    # jpg   y   20000000      \\xff \\xd8 \\xff \\xe0 \\x00 \\x10   \\xff\\xd9 \n    # jpg   y   20000000      \\xff\\xd8\\\\xff\\xe1\\xff\\xd9 \n    # jpg   y   20000000      \\xff\\xd8 \\xff\\xd9\n    ```\n\n5.  After completing the tests on the forensic image. Which do you think was more successful than the other? Does such opinion lead you to a conclusion?\n\n    **[Answer:]** \n    \n    I believe both are a good option and both could be used to make sure that we didn't miss anything.  PhotoRec by default found 10 files, while foremost found 9 by default and 4 when we modified its configuration file.\n\n## Task 3: File Carving using Scalpel\n\nWe will continue working with the same forensic image files as before, but this time with a new tool called Scalpel. Please make sure you use the custom \"scalpel.conf\" [located at **/root/Desktop/Module5/Lab13/scalpel.conf**] file provided. To run Scalpel with our specific configuration file, we can do the following:\n\n```\n# cd Desktop/Module5/Lab13\n# scalpel -c scalpel.conf FormattedDrive.001\n```\n\nAfter completing the analysis of the evidence:\n\n1.  Did scalpel manage to achieve carving the same number of files?\n\n    **[Answer:]**\n\n    No, because we didn't specify what type of files do we want to search for.\n\n2.  What was missing, and what must be done to correct that?\n\n    **[Answer:]**\n\n    The signatures were missing. We need to comment out the signatures for all files that we need to carve out (this should be executed inside the provided scalpel.conf file). After selecting the main types, it seems that scalpel did even better. Scalpel managed to carve out 17 files. It created a scalpel-output directory (unless specified something different) and with subdirectories of the file types, it managed to extract.\n\n## Task 4: Defining New File Signatures for PhotoRec\n\nIn this part of the lab, we want to prepare PhotoRec for a future task. PhotoRec by default is not able to extract Windows Prefetch files (don't ask what are they yet, that will come soon). In order to get PhotoRec equipped with such capabilities, we need to write our own signatures.\n\nFirst, I need you to check the URL below for the file signature of a **Window 8**|**8.1** prefetch file\n\n<http://www.garykessler.net/library/file_sigs.html>\n\nSo, first let's create a file named \"photorec.sig\" either in your users home directory (e.g., /root/) or in the same current working directory and then add the signature we found. You are supposed to have a file like this:\n\next     0      0x474946383761\n\n![6](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/6.png)\n\nThe first column represents the file extension of the file, in our case it is \"pf,\" then the offset, and finally the file signature which we found on Gary Kessler's file signature website. Make sure there is only a single space between them (Note: use spacebar, the line above has more just to provide a clearer explanation).\n\n1.  Which files were known, and which wasn't?\n\n    **[Answer:]**\n\n    We need to run PhotoRec and then check the File options section.\n\n2.  What must be done to identify all of them?\n\n    **[Answer:]**\n\n    All we need to do is select the file of interest using the space bar (toggle the selection).\n\n    **Note:** PhotoRec by default when run will load any custom created signatures. To make sure of that, just check the File Options screen.\n\n    ![7](https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/7.png)\n\n## Task 5: Using Bulk_extractor to Extract Data\n\nbulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. The results can be easily inspected, parsed, or processed with automated tools. More info: http://www.forensicswiki.org/wiki/Bulk_extractor and https://github.com/simsong/bulk_extractor/\n\nTo start **bulk_extractor** with its default settings, all you need to do is the following:\n\n```\n# cd Desktop/Module5/Lab13\n# bulk_extractor -o BulkResults FormattedDrive.001\n```\n\nThis will run bulk_extractor and extract all information and store them in the BulkResults directory. Now, check the contents of the results directory. All the domains and emails came from the files that bulk_extractor managed to locate and extract, plus free unallocated space that was previously used for file.\n\nSometimes you will have to carve parts of a file manually and sew the file together manually too using a hex editor!",
    "solutions_html": "<h1>SOLUTIONS</h1>\n<h2>Task 1: File Carving using PhotoRec</h2>\n<p>Let's start by using PhotoRec in order to answer the required questions. We can do that easily by doing the following:</p>\n<pre class=\"codehilite\"><code># cd Desktop/Module5/Lab13\n# photorec FormattedDrive.001</code></pre>\n\n<p>With that we reach the welcome message or banner of PhotoRec with some basic information about the tool, as you can see in the figure below:</p>\n<p><img alt=\"1\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/1.png\" /></p>\n<p>We can proceed, so just press <strong>Enter</strong> while the cursor has selected <strong>[Proceed]</strong>.</p>\n<p>After doing that, we reach the following:</p>\n<p><img alt=\"2\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/2.png\" /></p>\n<p>In this window, we need to select the file system or disk that we want to start carving files from. Now, in our case here, we have an NTFS partition and an entry for the whole disk. Since there could be evidence in other places other than the file system, let's select <strong>[Whole disk]</strong> and then press the <strong>[Search]</strong> button to proceed.</p>\n<p>Now, PhotoRec requires that we select the file system type that is being used, so make sure that <strong>[Other]</strong> is selected and then press <strong>Enter</strong>.</p>\n<p><img alt=\"3\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/3.png\" /></p>\n<p>Now, PhotoRec is asking you where to store the files that it will be carving; for this lab, you can leave the first selection (the <strong>.</strong> dot, to store in the same directory) and then press <strong>C</strong> to continue.</p>\n<p>After PhotoRec is finished, it will give you a summary of the number of files that have been carved and the location that was used to store them, as seen below:</p>\n<p><img alt=\"4\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/4.png\" /></p>\n<p>After that, press the <strong>[ QUIT ]</strong> button, then go to the <strong>[ QUIT ]</strong> button again to exit this window, then finally another <strong>[ QUIT ]</strong> to exit PhotoRec. You can use the arrows to navigate through the menu.</p>\n<p>So now we are ready to answer the questions:</p>\n<ol>\n<li>\n<p>How many pictures can you manage to carve?</p>\n<p><strong>[Answer:]</strong></p>\n<p>PhotoRec found 10 files.</p>\n<p>We can check the report generated, that is named report.xml.</p>\n</li>\n<li>\n<p>Did you find any suspicious pictures or were they ordinary pictures?</p>\n<p><strong>[Answer:]</strong> \nPictures of Mr.Robot and hacking stuff were found.</p>\n</li>\n<li>\n<p>Did you find any other files? What are they?</p>\n<p><strong>[Answer:]</strong></p>\n<p>Yes, I found a PDF File about Hacking, a couple of EXE files (Putty, PSFTP, and PSCP), also a 7zip file.</p>\n</li>\n<li>\n<p>Did you manage to open the other files you extracted, and why?</p>\n<p><strong>[Answer:]</strong></p>\n<p>Yes, except the 7zip file, because it was password protected.</p>\n</li>\n<li>\n<p>How can you identify the 7zip file using its header to verify that it is truly a 7zip file?</p>\n<p><strong>[Answer:]</strong></p>\n<p>We can use the following (note: change file.7z to the name of the carved file on your system):</p>\n<pre class=\"codehilite\"><code># xxd file.7z | head -n20</code></pre>\n\n<p>Using GaryKessler's file signature database online, we can prove that it truly is for a 7zip file. You can find the database at:    https://www.garykessler.net/library/file_sigs.html</p>\n</li>\n<li>\n<p>Did you manage to open the 7zip file? How did you do it, and what     was written in this report?</p>\n<p><strong>[Answer:]</strong></p>\n<p>Yes, while checking the photos available, we found a photo that had the following password written in it: Dylan_2791</p>\n<p>People tend to use such techniques to remember their passwords. So, after trying the password found, we managed to open the file and reach the content inside. We found the following text:</p>\n<p><pre class=\"codehilite\"><code>Mr.Robot Plan:\n1. Hack first machine\n2. Hack second machine\n3. Hack third machine\n4. Send SMS to +0018455550\n5. Solve the riddle :D\n6. Keep hacking until there is no machines :D\nPlan is to invade computers and keep hacking...</code></pre>\n<img alt=\"5\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/5.png\" /></p>\n</li>\n</ol>\n<h2>Task 2: File Carving using Foremost</h2>\n<p>In this task, we need to use Foremost instead of PhotoRec to see what differences can be found if any. To run the tool against our evidence, we need to do the following:</p>\n<pre class=\"codehilite\"><code># cd Desktop/Module5/Lab13\n# foremost -T FormattedDrive.001</code></pre>\n\n<p>Now let's answer the questions below:</p>\n<ol>\n<li>\n<p>What did you find? Do you have an idea why? (Hint: Do an ls and explore)</p>\n<p><strong>[Answer:]</strong></p>\n<p>We found that foremost carved a couple of files and created a subdirectory for each type. Also, it created a text file named <strong>audit.txt</strong> with         details of what was done, which was stored by default in a directory named <strong>output_DATE_TIME</strong>. By checking the audit.txt report in that folder, we found that foremost managed to find only 9 files.</p>\n</li>\n<li>\n<p>Update the foremost configuration file in order to carve specific files (PNG and PDF).</p>\n<p><strong>[Answer:]</strong></p>\n<p>What we need to do here is edit the <strong>foremost.conf</strong> configuration file and make sure we comment out the lines referring to PNG and PDF, which can be done like this:</p>\n<p><pre class=\"codehilite\"><code># vi /etc/foremost.conf</code></pre>\nThen search for the line below:\n<pre class=\"codehilite\"><code>#     png     y     200000 \\x50\\x4e\\x47?    \\xff\\xfc\\xfd\\xfe</code></pre></p>\n<p>And make sure you remove the <strong>#</strong> from the beginning of the line containing the file signature. Do the same for PDF, and after you finish press <strong>Esc</strong>, then <strong>:x</strong> (yes colon + x).</p>\n<p>Now if we run the command again like we did before, it will generate a directory with another directory with a new time stamp.</p>\n<p>This time four files were found: 3 PNG files and 1 PDF file.</p>\n</li>\n<li>\n<p>Could you tell what type of files foremost was searching for by default?</p>\n<p><strong>[Answer:]</strong></p>\n<p>From the man page of foremost, it says that it runs all pre-defined extraction methods. Most files are already built into foremost and can be carved out automatically. The configuration file is used to control or add other file formats that are not already defined by foremost.</p>\n</li>\n<li>\n<p>What must be done to locate JPG files for example?</p>\n<p><strong>[Answer:]</strong> </p>\n<p>Foremost is supposed to be able to carve them out automatically, but if you have specific configurations or want to make sure all variations, for example, are checked, then make sure you add and comment out the lines below from the foremost.conf file: \n<pre class=\"codehilite\"><code># jpg   y   20000000      \\xff \\xd8 \\xff \\xe0 \\x00 \\x10   \\xff\\xd9 \n# jpg   y   20000000      \\xff\\xd8\\\\xff\\xe1\\xff\\xd9 \n# jpg   y   20000000      \\xff\\xd8 \\xff\\xd9</code></pre></p>\n</li>\n<li>\n<p>After completing the tests on the forensic image. Which do you think was more successful than the other? Does such opinion lead you to a conclusion?</p>\n<p><strong>[Answer:]</strong> </p>\n<p>I believe both are a good option and both could be used to make sure that we didn't miss anything.  PhotoRec by default found 10 files, while foremost found 9 by default and 4 when we modified its configuration file.</p>\n</li>\n</ol>\n<h2>Task 3: File Carving using Scalpel</h2>\n<p>We will continue working with the same forensic image files as before, but this time with a new tool called Scalpel. Please make sure you use the custom \"scalpel.conf\" [located at <strong>/root/Desktop/Module5/Lab13/scalpel.conf</strong>] file provided. To run Scalpel with our specific configuration file, we can do the following:</p>\n<pre class=\"codehilite\"><code># cd Desktop/Module5/Lab13\n# scalpel -c scalpel.conf FormattedDrive.001</code></pre>\n\n<p>After completing the analysis of the evidence:</p>\n<ol>\n<li>\n<p>Did scalpel manage to achieve carving the same number of files?</p>\n<p><strong>[Answer:]</strong></p>\n<p>No, because we didn't specify what type of files do we want to search for.</p>\n</li>\n<li>\n<p>What was missing, and what must be done to correct that?</p>\n<p><strong>[Answer:]</strong></p>\n<p>The signatures were missing. We need to comment out the signatures for all files that we need to carve out (this should be executed inside the provided scalpel.conf file). After selecting the main types, it seems that scalpel did even better. Scalpel managed to carve out 17 files. It created a scalpel-output directory (unless specified something different) and with subdirectories of the file types, it managed to extract.</p>\n</li>\n</ol>\n<h2>Task 4: Defining New File Signatures for PhotoRec</h2>\n<p>In this part of the lab, we want to prepare PhotoRec for a future task. PhotoRec by default is not able to extract Windows Prefetch files (don't ask what are they yet, that will come soon). In order to get PhotoRec equipped with such capabilities, we need to write our own signatures.</p>\n<p>First, I need you to check the URL below for the file signature of a <strong>Window 8</strong>|<strong>8.1</strong> prefetch file</p>\n<p><a href=\"http://www.garykessler.net/library/file_sigs.html\">http://www.garykessler.net/library/file_sigs.html</a></p>\n<p>So, first let's create a file named \"photorec.sig\" either in your users home directory (e.g., /root/) or in the same current working directory and then add the signature we found. You are supposed to have a file like this:</p>\n<p>ext     0      0x474946383761</p>\n<p><img alt=\"6\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/6.png\" /></p>\n<p>The first column represents the file extension of the file, in our case it is \"pf,\" then the offset, and finally the file signature which we found on Gary Kessler's file signature website. Make sure there is only a single space between them (Note: use spacebar, the line above has more just to provide a clearer explanation).</p>\n<ol>\n<li>\n<p>Which files were known, and which wasn't?</p>\n<p><strong>[Answer:]</strong></p>\n<p>We need to run PhotoRec and then check the File options section.</p>\n</li>\n<li>\n<p>What must be done to identify all of them?</p>\n<p><strong>[Answer:]</strong></p>\n<p>All we need to do is select the file of interest using the space bar (toggle the selection).</p>\n<p><strong>Note:</strong> PhotoRec by default when run will load any custom created signatures. To make sure of that, just check the File Options screen.</p>\n<p><img alt=\"7\" src=\"https://assets.ine.com/content/ptp/lab_13_file_carving_and_creating_custom_signatures/7.png\" /></p>\n</li>\n</ol>\n<h2>Task 5: Using Bulk_extractor to Extract Data</h2>\n<p>bulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. The results can be easily inspected, parsed, or processed with automated tools. More info: http://www.forensicswiki.org/wiki/Bulk_extractor and https://github.com/simsong/bulk_extractor/</p>\n<p>To start <strong>bulk_extractor</strong> with its default settings, all you need to do is the following:</p>\n<pre class=\"codehilite\"><code># cd Desktop/Module5/Lab13\n# bulk_extractor -o BulkResults FormattedDrive.001</code></pre>\n\n<p>This will run bulk_extractor and extract all information and store them in the BulkResults directory. Now, check the contents of the results directory. All the domains and emails came from the files that bulk_extractor managed to locate and extract, plus free unallocated space that was previously used for file.</p>\n<p>Sometimes you will have to carve parts of a file manually and sew the file together manually too using a hex editor!</p>",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "default",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": [],
    "global_running_session": null
}