Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "softworkz ." <softworkz-at-hotmail.com@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] fftools/graphprint: Now, make it a Killer-Feature!
Date: Sun, 25 May 2025 10:50:53 +0000
Message-ID: <DM8P223MB0365DED9B77D357431E99F7ABA9AA@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <5010323.31r3eYUQgx@basile.remlab.net>


> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Rémi Denis-
> Courmont
> Sent: Samstag, 24. Mai 2025 17:55
> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] fftools/graphprint: Now, make it a
> Killer-Feature!
> 
> Le perjantaina 16. toukokuuta 2025, 1.19.15 Itä-Euroopan kesäaika softworkz .
> a écrit :
> > of course I understand that.
> > But it isn't constructed from untrusted input.
> 
> You're being ridiculous. `system()` has a long history of causign bugs, many
> of them security related, and many not fixable.
> 
> If you were implementing a command line interface that needs to process
> trusted input like the shell would, you would want to use `wordexp()`.
> 
> As you merely need to spawn a child process, use the `posix_spawn`*`()`
> available, and `fork()` then `exec`*`()` elsewhere. 


glibc's system() implementation is using posix_spawn internally since 2.34 and
before that, it is using fork() and execve() to launch sh.


> We don't want to spawn a
> shell just to start a well-known executable (other than the shell itself).

And yet, exactly the latter is happening, because the code is
invoking a shell script (xdg-open) - it doesn't launch a browser
executable.
Sadly, this has been misunderstood by many - who commented 
without even looking at the code.

Sure - we could invoke the script as an executable - that would
give us a single advantage: we would then supply the html file
path as an argument rather than in a command string. This 
prevents injection attacks that try to escape to the shell,
but that's just one possible attack vector. Just because we 
supply it as an argument to the script doesn't mean it's 
safe. The xdg-open scripts can differ by platform and can have
their own vulnerabilities. And since xdg-open is redirecting
to a variety of applications - from which every single one can 
have its own vulnerabilities, there is not much safety we 
would have gained by that.

It all burns down to this: 

It is our responsibility to make sure that the path we are
passing over is safe. No matter how we are calling xdg-open.

That path is constructed programmatically, it doesn't depend
on user input. It is constructed from the temp folder path
combined with a file name that has a fixed format generated 
from the time of execution.

There has been one comment (can't find it anymore) that I would
call the single most valid comment made in this regard, which 
was about the way how the temp path is determined on Linux,
and that's where I agree that it isn't safe enough in the way
how it was done.


Best regards,
sw

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-05-25 10:51 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250515211148.6C91C4128B8@natalya.videolan.org>
2025-05-15 21:50 ` Ramiro Polla
2025-05-15 21:59   ` softworkz .
2025-05-15 22:13     ` Ramiro Polla
2025-05-15 22:19       ` softworkz .
2025-05-15 22:33         ` softworkz .
2025-05-15 22:34         ` Mark Thompson
2025-05-15 22:43           ` softworkz .
2025-05-15 22:49             ` Ramiro Polla
2025-05-15 23:04               ` softworkz .
2025-05-15 23:29                 ` Ramiro Polla
2025-05-16  0:19                   ` softworkz .
2025-05-15 22:49           ` softworkz .
2025-05-24 15:54         ` Rémi Denis-Courmont
2025-05-25 10:50           ` softworkz . [this message]
2025-05-16  0:00     ` Marton Balint
2025-05-16  0:17       ` softworkz .
2025-05-16  0:27         ` James Almer
2025-05-16  0:32           ` softworkz .
2025-05-16  0:36             ` softworkz .
2025-05-16  0:39               ` James Almer
2025-05-16  0:45                 ` Lynne
2025-05-16  0:59                   ` softworkz .
2025-05-16  0:54         ` Michael Niedermayer
2025-05-16  1:26           ` softworkz .
2025-05-16  8:43             ` softworkz .
2025-05-16  9:41               ` softworkz .
2025-05-16  9:50                 ` Nicolas George
2025-05-16 10:10                   ` softworkz .
2025-05-16 11:10                     ` Nicolas George
2025-05-16 11:49                   ` Michael Niedermayer
2025-05-16 12:03                     ` Nicolas George
2025-05-31 21:38                       ` softworkz .
2025-05-16 13:42                     ` softworkz .
2025-05-16 13:45                       ` Nicolas George
2025-05-16  3:39           ` Romain Beauxis
2025-05-16  4:15             ` softworkz .
2025-05-16  5:06               ` softworkz .
2025-05-16  8:11           ` Marton Balint
2025-05-24 16:01           ` Rémi Denis-Courmont
2025-05-25 11:04             ` softworkz .
2025-05-15 21:53 ` James Almer
2025-05-15 21:58   ` softworkz .
2025-05-15 22:00     ` James Almer
2025-05-15 22:02       ` softworkz .
2025-05-16  2:06       ` softworkz .
2025-05-31 21:38       ` softworkz .
2025-05-16  6:22 ` Martin Storsjö
2025-05-16  6:40   ` softworkz .
2025-05-16  7:50   ` softworkz .
2025-05-16  8:13     ` Gyan Doshi
2025-05-16  8:19       ` softworkz .
2025-05-16  8:19     ` Martin Storsjö
2025-05-16  8:25       ` softworkz .
2025-05-16  8:50         ` Martin Storsjö
2025-05-16  8:55           ` softworkz .

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM8P223MB0365DED9B77D357431E99F7ABA9AA@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM \
    --to=softworkz-at-hotmail.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git