homepage
Open menu
Go one level top
  • Train and Certify
    Train and Certify

    Immediately apply the skills and techniques learned in SANS courses, ranges, and summits

    • Overview
    • Courses
      • Overview
      • Full Course List
      • By Focus Areas
        • Cloud Security
        • Cyber Defense
        • Cybersecurity and IT Essentials
        • DFIR
        • Industrial Control Systems
        • Offensive Operations
        • Management, Legal, and Audit
      • By Skill Levels
        • New to Cyber
        • Essentials
        • Advanced
        • Expert
      • Training Formats
        • OnDemand
        • In-Person
        • Live Online
      • Course Demos
    • Training Roadmaps
      • Skills Roadmap
      • Focus Area Job Roles
        • Cyber Defence Job Roles
        • Offensive Operations Job Roles
        • DFIR Job Roles
        • Cloud Job Roles
        • ICS Job Roles
        • Leadership Job Roles
      • NICE Framework
        • Security Provisionals
        • Operate and Maintain
        • Oversee and Govern
        • Protect and Defend
        • Analyze
        • Collect and Operate
        • Investigate
        • Industrial Control Systems
    • GIAC Certifications
    • Training Events & Summits
      • Events Overview
      • Event Locations
        • Asia
        • Australia & New Zealand
        • Latin America
        • Mainland Europe
        • Middle East & Africa
        • Scandinavia
        • United Kingdom & Ireland
        • United States & Canada
      • Summits
    • OnDemand
    • Get Started in Cyber
      • Overview
      • Degree and Certificate Programs
      • Scholarships
    • Cyber Ranges
  • Manage Your Team
    Manage Your Team

    Build a world-class cyber team with our workforce development programs

    • Overview
    • Why Work with SANS
    • Group Purchasing
    • Build Your Team
      • Team Development
      • Assessments
      • Private Training
      • Hire Cyber Professionals
      • By Industry
        • Health Care
        • Industrial Control Systems Security
        • Military
    • Leadership Training
  • Security Awareness
    Security Awareness

    Increase your staff’s cyber awareness, help them change their behaviors, and reduce your organizational risk

    • Overview
    • Products & Services
      • Security Awareness Training
        • EndUser Training
        • Phishing Platform
      • Specialized
        • Developer Training
        • ICS Engineer Training
        • NERC CIP Training
        • IT Administrator
      • Risk Assessments
        • Knowledge Assessment
        • Culture Assessment
        • Behavioral Risk Assessment
    • OUCH! Newsletter
    • Career Development
      • Overview
      • Training & Courses
      • Professional Credential
    • Blog
    • Partners
    • Reports & Case Studies
  • Resources
    Resources

    Enhance your skills with access to thousands of free resources, 150+ instructor-developed tools, and the latest cybersecurity news and analysis

    • Overview
    • Webcasts
    • Free Cybersecurity Events
      • Free Events Overview
      • Summits
      • Solutions Forums
      • Community Nights
    • Content
      • Newsletters
        • NewsBites
        • @RISK
        • OUCH! Newsletter
      • Blog
      • Podcasts
      • Summit Presentations
      • Posters & Cheat Sheets
    • Research
      • White Papers
      • Security Policies
    • Tools
    • Focus Areas
      • Cyber Defense
      • Cloud Security
      • Digital Forensics & Incident Response
      • Industrial Control Systems
      • Cyber Security Leadership
      • Offensive Operations
  • Get Involved
    Get Involved

    Help keep the cyber community one step ahead of threats. Join the SANS community or begin your journey of becoming a SANS Certified Instructor today.

    • Overview
    • Join the Community
    • Work Study
    • Teach for SANS
    • CISO Network
    • Partnerships
    • Sponsorship Opportunities
  • About
    About

    Learn more about how SANS empowers and educates current and future cybersecurity practitioners with knowledge and skills

    • SANS
      • Overview
      • Our Founder
      • Awards
    • Instructors
      • Our Instructors
      • Full Instructor List
    • Mission
      • Our Mission
      • Diversity
      • Scholarships
    • Contact
      • Contact Customer Service
      • Contact Sales
      • Press & Media Enquiries
    • Frequent Asked Questions
    • Customer Reviews
    • Press
    • Careers
  • Contact Sales
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  • Log In
  • Join
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Digital Forensics: In-depth analysis of SRM and BCWipe (for unix)
Juan Leaniz

Digital Forensics: In-depth analysis of SRM and BCWipe (for unix)

January 19, 2011

Secure wiping tools are nothing new, we've all seen and used them for a long time now. It's no mystery that these tools are used by intruders to cover their tracks by securely deleting files such as logs, or other files they downloaded onto compromised systems. Organizations also use these tools to securely delete confidential information, so it's important to know how the tools operate. After all, the difference between a good forensic analyst and a great analyst, is knowing how the tools we use work behind the scenes.

I would like to start by noting that while i was doing some tests to write this post, I came across an issue with syncing and Linux. I tried to wipe a few files using srm, shred and BCwipe to see if they did anything differently. I used The SleuthKit's istat, icat and blkcat to be able to find the block and inode numbers for my test file and then view the block's contents. The odd thing is that after wiping the file with bcwipe, srm or shred I was still able to see the contents with blkcat.

asm boot # ls -li /boot/randfile
10083 -rw-r—- 1 root root 40 Jan 17 12:07 randfile
asm boot # istat /dev/sda1 10083
inode: 10083
AllocatedGroup: 5
Generation Id: 313379932
uid / gid: 0 / 0
mode: rrw-r—-size: 40
num of links: 1
Inode Times:
Accessed:Mon Jan 17 12:07:52 2011
File Modified:Mon Jan 17 12:07:52 2011
Inode Modified:Mon Jan 17 12:07:52 2011
Direct Blocks:
42497

asm boot # dcat /dev/sda1 42497
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
asm boot #
asm boot # man bcwipe
asm boot # bcwipe -mz randfile
Wipe randfile (y/[n]/a)?y
asm boot # dcat /dev/sda1 42497
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
asm boot # ls -la | grep randfile
asm boot # dcat /dev/sda1 42497
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

After consulting on the GCFA mailing-list I realized the problem was with synchronizing data on disk with memory, using the sync command and modifying the drop_caches value seemed to fix the problem.

echo 3 >/proc/sys/vm/drop_caches 

Both srm and BCwipe support many different wiping algorithms, such as DoD compliant 7-pass, Gutmann's method, etc.

This is actually how the data is overwritten by BCwipe. If we look at the source code we will find most of the relevant functions in the file wipe.c. The function bcwipe_write() has a call to the write() C function, which writes a buffer into a file descriptor, that buffer will be filled with either random data or zeros. bcwipe_write() is called by do_wipe_pass() which is subsequently called by wipe_pass(), bcwipe_write() will overwrite the data using the scheme we chose and N passes, depending on the scheme. The wiping schemes are defined in schemes.c, if we wanted to create a new type of wiping scheme we should start by adding it there. If you do that though, you may be violating BCwipe's EULA.

SRM works in a very similar way, looking at it's source code we can see that sunlink.c has most of the relevant functions. Just like BCwipe, SRM has its' own custom write function called writen(), it also calls the write() C function and does some error checking.

We can see several overwrite functions:

  • overwrite()
  • overwrite_random()
  • overwrite_byte()
  • overwrite_bytes()

The names are very self-explanatory. overwrite_random() is used to write a buffer with random data (the random data is generated by randomize_buffer() in random.c), overwrite_byte() to write a buffer containing a specific byte of data, and overwrite_bytes() to write a buffer with 3 specific bytes (this is needed for the Gutmann and DoE overwrite specifications). All these functions will ultimately call overwrite() which uses SRM's writen() function to write the buffers to a file descriptor.

I wanted to see if there was anything left behind by SRM or BCwipe that could lead to the conclusion that wiping tools were used, so i created a test file and analyzed what it's allocated space contained before and after wiping it.

For these tests i used the DoD compliant 7-pass specification, but it's likely you will find the same result with any other specification.

asm boot #perl -e 'print "A"x40000'> /boot/randfilee
asm boot # istat /dev/sda1 10083
inode: 10083
Allocated
Group: 5
Generation Id: 313379940
uid / gid: 0 / 0
mode: rrw-r—-
size: 40000
num of links: 1
Inode Times:
Accessed:Tue Jan 18 08:51:03 2011
File Modified:Tue Jan 18 08:51:52 2011
Inode Modified:Tue Jan 18 08:51:52 2011
Direct Blocks:
43009 43010 43011 43012 43013 43014 43015 43016
43017 43018 43019 43020 43022 43023 43024 43025
43026 43027 43028 43029 43030 43031 43032 43033
43034 43035 43036 43037 43038 43039 43040 43041
43042 43043 43044 43045 43046 43047 43048 43049
Indirect Blocks:
43021

All I did there was find inode and block numbers for my test file so I could then use blkcat to see the contents.

asm boot # blkcat -h /dev/sda1 430090
 41414141 41414141 41414141 41414141 AAAA AAAA AAAA AAAA
16 41414141 41414141 41414141 41414141 AAAA AAAA AAAA AAAA
...
992 41414141 41414141 41414141 41414141 AAAA AAAA AAAA AAAA
1008 41414141 41414141 41414141 41414141 AAAA AAAA AAAA AAAA
asm boot # blkcat -h /dev/sda1 43021
0 0ea80000 0fa80000 10a80000 11a80000 .... .... .... ....
16 12a80000 13a80000 14a80000 15a80000 .... .... .... ....
32 16a80000 17a80000 18a80000 19a80000 .... .... .... ....
48 1aa80000 1ba80000 1ca80000 1da80000 .... .... .... ....
64 1ea80000 1fa80000 20a80000 21a80000 .... .... ... !...
80 22a80000 23a80000 24a80000 25a80000 "... #... $... %...
96 26a80000 27a80000 28a80000 29a80000 &... '... (... )...
112 00000000 00000000 00000000 00000000 .... .... .... ....
...
992 00000000 00000000 00000000 00000000 .... .... .... ....
1008 00000000 00000000 00000000 00000000 .... .... .... ....

Here I checked the contents with TSK's blkcat and saw a bunch of A's as was expected and the indirect block contains other block numbers (in hex). So the next step was to wipe the file with srm and see what was left behind.

asm boot # srm -Df randfile
asm boot # blkcat -h /dev/sda1 43009
0 8e42d882 60df83f7 599fdf78 2a6ca3b9 .B.. `... Y..x *l..
16 cfbac122 050db37d e461324c ac08c138 ..." ...} .a2L ...8
...
992 26272cfd cb14e9ae 38821a73 ee2e70ac &',. .... 8..s ..p.
1008 eed20f83 70fd3d53 b43cd865 204fbfac .... p.=S .<.e O..
asm boot # blkcat -h /dev/sda1 43021
0 0ea80000 0fa80000 10a80000 11a80000 .... .... .... ....
16 12a80000 13a80000 14a80000 15a80000 .... .... .... ....
32 16a80000 17a80000 18a80000 19a80000 .... .... .... ....
48 1aa80000 1ba80000 1ca80000 1da80000 .... .... .... ....
64 1ea80000 1fa80000 20a80000 21a80000 .... .... ... !...
80 22a80000 23a80000 24a80000 25a80000 "... #... $... %...
96 26a80000 27a80000 28a80000 29a80000 &... '... (... )...
112 00000000 00000000 00000000 00000000 .... .... .... ....
...
992 00000000 00000000 00000000 00000000 .... .... .... ....
1008 00000000 00000000 00000000 00000000 .... .... .... ....

Random data was left behind on the direct blocks, this is normal. But what's interesting is that the indirect block (43021) was not overwritten and you can still see the block numbers in hex. Hal Pomeranz discovered the same behavior with the shred utility, it's very interesting to know that SRM and BCwipe also share the same behavior.

Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Tags:
  • Digital Forensics and Incident Response

Related Content

Blog
Top_10_Summit_Talks_2022.png
Cybersecurity Insights, Digital Forensics and Incident Response, Cyber Defense, Cloud Security, Open-Source Intelligence (OSINT), Security Management, Legal, and Audit, Security Awareness
December 5, 2022
Top 10 SANS Summits Talks of 2022
This year, SANS hosted 13 Summits with 246 talks. Here were the top-rated talks of the year.
370x370-person-placeholder.png
Alison Kim
read more
Blog
FOR577.png
Digital Forensics and Incident Response
September 22, 2022
NEW SANS DFIR COURSE IN DEVELOPMENT | FOR577: LINUX Incident Response & Analysis
FOR577: Linux Incident Response & Analysis course teaches how Linux systems work and how to respond and investigate attacks effectively.
Viv_Ross_370x370.png
Viviana Ross
read more
Blog
Untitled_design-43.png
Digital Forensics and Incident Response, Cybersecurity and IT Essentials, Industrial Control Systems Security, Purple Team, Open-Source Intelligence (OSINT), Penetration Testing and Red Teaming, Cyber Defense, Cloud Security, Security Management, Legal, and Audit
December 8, 2021
Good News: SANS Virtual Summits Will Remain FREE for the Community in 2022
They’re virtual. They’re global. They’re free.
370x370-person-placeholder.png
Emily Blades
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters & Cheat Sheets
  • White Papers
  • Focus Areas
  • Cyber Defense
  • Cloud Security
  • Cybersecurity Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • © 2023 SANS™ Institute
  • Privacy Policy
  • Contact
  • Careers
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn