Your message dated Mon, 02 Nov 2026 11:35:10 +0000
with message-id <[email protected]>
and subject line Bug#1149575: fixed in steghide 0.5.1+git20240220-3
has caused the Debian Bug report #1149575,
regarding steghide: embed reads freed list nodes in DFSAPHeuristic 
(heap-use-after-free, intermittent SIGSEGV)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1149575: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1149575
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: steghide
Version: 0.5.1+git20240220-2
Severity: normal
Tags: patch

Dear Maintainer,

"steghide embed" intermittently reads freed memory while computing the
matching, and on some platforms segfaults. The embed RNG is seeded from
/dev/urandom, so the same command crashes on some runs and succeeds on others.
The bug is present in 0.5.1+git20240220-2 (sid/forky) and in 0.5.1-15
(bookworm/trixie), and current upstream (github.com/StegHigh/steghide) has the
same code.

Reproduction (debian:sid container, arm64, steghide 0.5.1+git20240220-2 with
steghide-dbgsym):

python3 -c 'import random, struct; open("cover.au", 
"wb").write(struct.pack(">6I", 0x2e736e64, 24, 32000, 1, 8000, 1) + 
random.Random(546).randbytes(32000))'
printf 'north of the old bridge\n' > msg.txt
for i in $(seq 1 40); do
valgrind -q steghide embed -cf cover.au -sf out.au -ef msg.txt -p "" -f -q 
2>vg.$i >/dev/null
done
grep -l "Invalid read" vg.* | wc -l

10 of 40 runs report the invalid read below. With glibc the stale read usually
goes unnoticed, so the native binary did not crash in 100 runs. A native macOS
arm64 build of the 0.5.1-15 sources segfaults on 17 of 100 plain runs of the
same command, and an AddressSanitizer build reports heap-use-after-free with
the same stacks. 16-bit PCM WAV and AU covers crash too, at a lower rate (about
4 of 100 with a 256-byte payload).

Invalid read of size 8
at 0x401DA74: operator++ (stl_list.h:708)
by 0x401DA74: EdgeIterator::operator++() (EdgeIterator.cc:72)
by 0x401040F: DFSAPHeuristic::getNextEdge(Vertex*) (DFSAPHeuristic.cc:227)
by 0x4010637: DFSAPHeuristic::searchAugmentingPath(Vertex*, Edge const**) 
(DFSAPHeuristic.cc:155)
by 0x401086F: DFSAPHeuristic::run() (DFSAPHeuristic.cc:81)
by 0x401F5CF: Embedder::calculateMatching(ProgressOutput*) (Embedder.cc:221)
by 0x4020757: Embedder::embed() (Embedder.cc:168)
by 0x4031BEF: Session::run() (Session.cc:40)
by 0x40069FB: main (main.cc:95)
Address 0x5162aa0 is 0 bytes inside a block of size 32 free'd
at 0x48E9774: operator delete(void*, unsigned long) (vg_replace_malloc.c:1146)
by 0x40233C3: erase (list.tcc:153)
by 0x40233C3: 
Graph::markDeletedSampleOccurence(std::_List_iterator<SampleOccurence>) 
(Graph.cc:199)
by 0x40333DF: Vertex::markDeleted() (Vertex.cc:97)
by 0x403A597: SMDConstructionHeuristic::run() (SMDConstructionHeuristic.cc:51)
by 0x401F5CF: Embedder::calculateMatching(ProgressOutput*) (Embedder.cc:221)
by 0x4020757: Embedder::embed() (Embedder.cc:168)
by 0x4031BEF: Session::run() (Session.cc:40)
by 0x40069FB: main (main.cc:95)

Cause: CvrStgFile::getMatchingAlgorithms() (and the AuFile override)
constructs every algorithm before any of them runs. The DFSAPHeuristic
constructor resets one EdgeIterator per vertex, which stores iterators into
Graph::SampleOccurences. The construction heuristic runs next (SMD for AU,
WKS otherwise): Vertex::markDeleted() erases those list nodes and
Graph::unmarkDeletedAllVertices() inserts new ones. searchAugmentingPath()
marks a matched vertex visited without resetting its iterator, so a later
getNextEdge() on that vertex takes the "already visited" branch and advances
the stale iterator.

The attached patch resets every edge iterator at the start of
DFSAPHeuristic::run(), after the construction heuristic has finished. I built
0.5.1+git20240220-2 with it added to debian/patches/series. Valgrind then
reported no invalid reads in 40 runs of the reproduction above (10 of 40
before), and every output extracted back to the original message.
Independently, an AddressSanitizer build of the 0.5.1-15 sources with the
patch produced 400 clean embed/extract round trips on AU and WAV covers
(unpatched: 29 use-after-free reports in 200 runs).

-- patch: debian/patches/reset-edge-iterators-before-dfsap.patch --

Description: Reset DFSAPHeuristic edge iterators before searching paths
DFSAPHeuristic's constructor points one EdgeIterator per vertex into
Graph::SampleOccurences. The matching algorithms are all constructed before
any runs, so the construction heuristic that runs first (SMD for AU, WKS
otherwise) then erases those list nodes in Vertex::markDeleted() and inserts
fresh ones in unmarkDeletedAllVertices(). searchAugmentingPath() marks a
matched vertex visited without resetting its iterator, so a later
getNextEdge() on that vertex advances a freed node: a heap-use-after-free
that intermittently segfaults "steghide embed", since the random seed
changes the search path. Resetting every iterator when run() starts points
them at the current lists.
Author: Tyler Miller <[email protected]>
Forwarded: no
Last-Update: 2026-09-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/DFSAPHeuristic.cc
+++ b/src/DFSAPHeuristic.cc
@@ -73,6 +73,12 @@
void DFSAPHeuristic::run ()
{
const Edge** path = new const Edge*[TheGraph->getNumVertices()] ;
+
+ // construction heuristics ran after the constructor and erased/reinserted
+ // the sample occurence list nodes the iterators point to
+ for (VertexLabel l = 0 ; l < TheGraph->getNumVertices() ; l++) {
+ EdgeIterators[l].reset() ;
+ }

const std::list<Vertex*> ExposedVertices = TheMatching->getExposedVertices() ; 
for (std::list<Vertex*>::const_iterator expv = ExposedVertices.begin() ;

--- End Message ---
--- Begin Message ---
Source: steghide
Source-Version: 0.5.1+git20240220-3
Done: Sven Geuer <[email protected]>

We believe that the bug you reported is fixed in the latest version of
steghide, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Sven Geuer <[email protected]> (supplier of updated steghide package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Mon, 02 Nov 2026 12:03:58 +0100
Source: steghide
Architecture: source
Version: 0.5.1+git20240220-3
Distribution: unstable
Urgency: medium
Maintainer: Debian Security Tools <[email protected]>
Changed-By: Sven Geuer <[email protected]>
Closes: 1149575
Changes:
 steghide (0.5.1+git20240220-3) unstable; urgency=medium
 .
   * Team upload.
   * d/p/*: Add patch fixing heap-use-after-free in DFSAPHeuristic.
     Thanks to Tyler Miller for the patch.
     (Closes: #1149575)
   * d/p/consolidated-gcc-patches.patch: Add Author, based on git blame.
   * d/control: Bump debhelper-compat to 14. Consequently drop all ${*:Depends}
     substvars.
   * d/t/*: Introduce non-superficial test.
   * d/rules: Preserve original po/ru.po, it gets modified during build.
   * d/u/metadata: Update it to the current upstream repo.
Checksums-Sha1:
 a634246dc0a97314834beda8f88509579cad80de 2219 steghide_0.5.1+git20240220-3.dsc
 fae9eb3d16764448d404dc31cb62b7bbf638a06c 15704 
steghide_0.5.1+git20240220-3.debian.tar.xz
 be7ffbd9423e0597227c651e2d54dcbc167f7f03 6031 
steghide_0.5.1+git20240220-3_source.buildinfo
Checksums-Sha256:
 33cdacb19180bdf5f06f73fa5d029cb6d004f381cfb0e8d50014dfafcb74cbf4 2219 
steghide_0.5.1+git20240220-3.dsc
 a9747eac2c5f6350de28eb477e47600eb329a812cfb3b17dcbe69d2d1574a97a 15704 
steghide_0.5.1+git20240220-3.debian.tar.xz
 59ba53e0bee9d0c46581173db28604bd84b062ca9105b2f62756b99ff0c040c2 6031 
steghide_0.5.1+git20240220-3_source.buildinfo
Files:
 43a388a3d9c6c24d33226dd566f9e2a4 2219 misc optional 
steghide_0.5.1+git20240220-3.dsc
 812c669f337a193ab06eed4e520dfb2d 15704 misc optional 
steghide_0.5.1+git20240220-3.debian.tar.xz
 9fc160b031258b6016b8c098d177c6c8 6031 misc optional 
steghide_0.5.1+git20240220-3_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEPfXoqkP8n9/QhvGVrfUO2vit1YUFAmrocSUPHHNnZUBkZWJp
YW4ub3JnAAoJEK31Dtr4rdWFDTcP/jo9V2RdEw42b9hBqPvPoi6mhNu0ZE8KeJQs
pVTmp499H+yw3GLFHhTHn0JmL/CKRi8GM04IRrOdVIjRznZB9fjzDjNzqSdkH3Um
mwEoscuuLdALSx0U3mNfh1NRS0cZt85ey5J+P3Rzt4c7eI6fcL+JsS+Hi3LYjjKV
rJABwGNDx3byEv1oxRLJZFozoUZk5zCeZF1RnELLMp4S6qCO9DAcSIV9M2PdYogR
6rpwVomhuDviRjoIZ9GYGpT5Z/1/uyyjx/b1Uyi7ujKVGWFB4x+E0VovQ4GbSWKV
Txuvprrw7CvZbVxPxumtxTJ+tTbYrU90ssyHU0OTwfTaIXIvicRNAtkqoOMsufiP
teiRwLpR+jNZBHkvLRqE0vldeXcHCKH/3KQ2jDOgjlgL2KfCFjLBDYbfcXBIEOIz
A1bQFk306GGNWBCElVZ4NtXNznsdNfgzR+TtnNRxV7+uLqLAMhrCGoCjwoEqWxaz
bBMGNoQy7wpJd6TP386gqp7ZTEEqvGJoyeNU41TG2gdQiXy5DyZUdLV/ZiDY33Bt
yvzIzx8u5yKD3h8mzLuJPyvZ/wyNuxrYntpAk5lsuIMpj5ruY2KqEvsSDtaC6CBY
/GQvRZLpZ8QO/9eDAnHWJ+pGYw9n7IRTbTvmbVcKkeWTHlZzWHYdH9BLo102M/7r
jG3sGAyP
=S2Jf
-----END PGP SIGNATURE-----

Attachment: pgpYOHF2zLNxT.pgp
Description: PGP signature


--- End Message ---

Reply via email to