From nobody Mon Mar 21 15:17:33 2022 X-Original-To: freebsd-security@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0F1C01A37A85 for ; Mon, 21 Mar 2022 15:17:38 +0000 (UTC) (envelope-from sam.ricchio@gmail.com) Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KMdXJ58Y9z4s28 for ; Mon, 21 Mar 2022 15:17:36 +0000 (UTC) (envelope-from sam.ricchio@gmail.com) Received: by mail-ot1-x32d.google.com with SMTP id x8-20020a9d6288000000b005b22c373759so10701368otk.8 for ; Mon, 21 Mar 2022 08:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=5wgRbzIEp0GIdfPPaPBehWuUOyF0mCKBKZRfWta2N/U=; b=hy1gnpEmE1cjQobXwue8B6CCYgouCXV22HEPw2HfFPD4KbO5/Q7eNBpCcXoqdtAv6u Tp5cDN+7TgHlhGjTs7KxT6csK8Kf3NN5xIe/PPbeP8JO8X81wE/h9yfCH35hm0/KAdpY AVoPdg57N6w6YxMFCtIREQWhhxhNRXYm3m1de5p47hPK/MFmGp8VhM7wIVFySlOqfYQa GaNnLKVmIhajIHJB5QxlCOKaqjsI2r7x34vmC4szABXA1ghz2GE1VTCbqWiIR8ZHqBo7 vYwHPO+k9H1Rf1T1ob5RQxxolZd3ljr3WC3ebim5FcNpMGEsOHk2ryhUZbunRp8wOH19 FdeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=5wgRbzIEp0GIdfPPaPBehWuUOyF0mCKBKZRfWta2N/U=; b=q0JQWVvBRKWXukaB30WxRmOAPO3/p8NyG020scfJ3h+LqNoi1rKlGibzlK2IostlmT Q0cn24B3HdEm4h6tKRapk1JmcWsjBMVQ+dg8T54LWZaq+sKO4ePon6KkmiwkDym4fMY5 nmLL7UdYdpEAtGwStz2F68HRo4TS3APcxuM0Qiv93X4YN7JCORUrbrSTwViUwdBv0QRG BAy52i4oXDAMtofuWNu/kSolQHUD8jT2Cw8CYd4roI5UDnICQ4kZBTsXPpcsI9RmvYj0 xN2b3Aoso9QZWWn/ZISbKr6MMcaq6sG/Td4XfoKxoDypTJjz4VVdsE1RbYyE+sBg3aiT GjkQ== X-Gm-Message-State: AOAM533z+46yifYQQTS7T1Mf0MzZdDJHtLZJyuBKrv6fHvrbNxvIO7Bl p/kykm2D7fATI0GFo+BF+q56AVjbHQ== X-Google-Smtp-Source: ABdhPJxl+lX2rXcymFQ6XlMXGy5EGgy7FFDFqeBMtmnh3iDDVrpwuvVGCDhZ+/yHa0xMpnPSvHm2lA== X-Received: by 2002:a9d:6189:0:b0:5b2:4da6:30e2 with SMTP id g9-20020a9d6189000000b005b24da630e2mr8091332otk.141.1647875855795; Mon, 21 Mar 2022 08:17:35 -0700 (PDT) Received: from [192.168.2.55] (96-8-248-196.block0.gvtc.com. [96.8.248.196]) by smtp.gmail.com with ESMTPSA id f7-20020aca3807000000b002eef684bd2fsm7454605oia.40.2022.03.21.08.17.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Mar 2022 08:17:35 -0700 (PDT) From: Sam Ricchio Content-Type: multipart/alternative; boundary="Apple-Mail=_F0850484-1739-4CA6-8CAF-A4F9D327999F" List-Id: Security issues List-Archive: https://lists.freebsd.org/archives/freebsd-security List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-security@freebsd.org X-BeenThere: freebsd-security@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: SSD erase question Date: Mon, 21 Mar 2022 10:17:33 -0500 References: <274c8cca-80b0-9460-6754-6bb77efbb4dd@htwsaar.de> To: Damian Weber , freebsd-security@freebsd.org In-Reply-To: <274c8cca-80b0-9460-6754-6bb77efbb4dd@htwsaar.de> Message-Id: <1ACC7A67-BDBA-4CD3-87EC-822C38CD7CE7@gmail.com> X-Mailer: Apple Mail (2.3445.104.21) X-Rspamd-Queue-Id: 4KMdXJ58Y9z4s28 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=hy1gnpEm; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of samricchio@gmail.com designates 2607:f8b0:4864:20::32d as permitted sender) smtp.mailfrom=samricchio@gmail.com X-Spamd-Result: default: False [-3.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; RECEIVED_SPAMHAUS_PBL(0.00)[96.8.248.196:received]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-security@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::32d:from]; MLMMJ_DEST(0.00)[freebsd-security]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_F0850484-1739-4CA6-8CAF-A4F9D327999F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On and SSD if you have erased everything ssd =E2=80=9Cgarbage = collection=E2=80=9D should help you if the drive it powered on. But if you want to overwrite the drive A simple overwrite with a text pattern with dc3dd. dc3dd wipe=3D/dev/sdb tpat=3Dnothingtoseehere However if you are still worried that some controller optimization is = interfering with and actual memory location overwrite. Go old school with dd and = write a file of random to the existing file system until it runs out of space. dd if=3D/dev/urandon of=3Dgarbagetxtfile.txt On Mar 21, 2022, at 7:14 AM, Damian Weber wrote: Hi all, I'd like to have an answer on a secure FreeBSD way to erase=20 SSDs before giving these away to someone for reusing it.=20 Is the following enough to protect confidential data=20 previously stored there? 1) dd : overwriting with random bits (complete capacity) 2) gpart create 3) gpart add 4) newfs Details for an example with /dev/ada1 see below. Thanks a lot, Damian # fdisk ada1 ******* Working on device /dev/ada1 ******* parameters extracted from in-core disklabel are: cylinders=3D484521 heads=3D16 sectors/track=3D63 (1008 blks/cyl) Figures below won't work with BIOS for partitions not in cyl 1 parameters to be used for BIOS calculations are: cylinders=3D484521 heads=3D16 sectors/track=3D63 (1008 blks/cyl) Media sector size is 512 Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 238 (0xee),(EFI GPT) start 1, size 488397167 (238475 Meg), flag 0 beg: cyl 0/ head 0/ sector 2; end: cyl 1023/ head 255/ sector 63 The data for partition 2 is: The data for partition 3 is: The data for partition 4 is: # gpart show ada1 =3D> 40 488397088 ada1 GPT (233G) 40 1024 1 freebsd-boot (512K) 1064 480246784 2 freebsd-ufs [bootme] (229G) 480247848 8149280 3 freebsd-swap (3.9G) # dd if=3D/dev/random of=3D/dev/ada1 bs=3D512 count=3D488397088 # gpart create -s gpt ada1 # gpart add -t freebsd-ufs ada1 # newfs -U /dev/ada1p1 --Apple-Mail=_F0850484-1739-4CA6-8CAF-A4F9D327999F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On and SSD if you have erased everything ssd =E2=80=9Cgarbage = collection=E2=80=9D should help you if the drive it powered = on.
But if you want to overwrite the = drive
A simple overwrite with a text pattern with = dc3dd.
dc3dd = wipe=3D/dev/sdb tpat=3Dnothingtoseehere
However if you are still worried that some controller = optimization is interfering
with and actual memory location overwrite.  Go old = school with dd and write
a file of random to the existing file system until it runs = out of space.
dd = if=3D/dev/urandon of=3Dgarbagetxtfile.txt




On Mar 21, 2022, = at 7:14 AM, Damian Weber <dweber@htwsaar.de> wrote:


Hi all,

I'd like to have an = answer on a secure FreeBSD way to erase
SSDs before = giving these away to someone for reusing it.

Is the following enough to protect confidential data
previously stored there?

1) =  dd : overwriting with random bits (complete capacity)
2)  gpart create
3)  gpart add
4)  newfs

Details for an = example with /dev/ada1 see below.

Thanks a = lot,

  Damian


# fdisk ada1
******* Working on = device /dev/ada1 *******
parameters extracted from in-core = disklabel are:
cylinders=3D484521 heads=3D16 = sectors/track=3D63 (1008 blks/cyl)

Figures = below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3D484521 heads=3D16 sectors/track=3D63 (1008 = blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for = partition 1 is:
sysid 238 (0xee),(EFI GPT)
=    start 1, size 488397167 (238475 Meg), flag 0
       beg: cyl 0/ head = 0/ sector 2;
=        end: cyl 1023/ head 255/ = sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

# gpart show = ada1
=3D>       40 =  488397088  ada1  GPT  (233G)
=         40 =       1024     1 =  freebsd-boot  (512K)
=       1064  480246784 =     2  freebsd-ufs  [bootme] =  (229G)
 480247848    8149280 =     3  freebsd-swap  (3.9G)

# dd if=3D/dev/random of=3D/dev/ada1 bs=3D512 = count=3D488397088

# gpart create -s gpt = ada1

# gpart add -t freebsd-ufs ada1

# newfs -U /dev/ada1p1



= --Apple-Mail=_F0850484-1739-4CA6-8CAF-A4F9D327999F--