From: "softworkz ." <softworkz-at-hotmail.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] The "bad" Patch Date: Mon, 2 Jun 2025 06:09:34 +0000 Message-ID: <DM8P223MB03658818BF3571793E34CD49BA62A@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> (raw) In-Reply-To: <088d9dbd-3b74-4571-bf7d-463e174bbd8d@jkqxz.net> > -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Mark > Thompson > Sent: Samstag, 31. Mai 2025 22:26 > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] The "bad" Patch > Hello Mark, (I've re-ordered some parts to unclutter the conversation) > It does not seem unreasonable for people to treat the appearance of a > vulnerable call to system() like seeing self-rolled cryptography: the > submitter is almost certainly either incompetent or malicious, and can be > safely ignored. That's great because this gets to the essence of what we're talking about and here I beg to differ: My point is that exactly this way of judgement you are describing is itself a sign of incompetence instead. This isn't meant to be a rhetoric or flaming statement. It follows from the simple and confirmed reasoning that hardly anybody would have recognized or objected when I would have included the internal implementation of system() instead. This invalidates the former in total. But "incompetence" was your word. I wouldn't call it like that because I do not want to insult anybody and I do not deem anybody here to be. Rather would I call it "lazy judgement", as that's what's happened: One said: "I've seen system()" And a choir started singing: "Bad, bad, revert, revert" - without looking at the code, without own judgement and consideration. (except yours and possibly others who didn't sing) > In some cases they may in fact be capable and benign Thanks for confirming this explicitly. > but it is up to the submitter to show when doing that that they understand > all of the issues and have properly dealt all of them. This code is what I had posted for review. I have sufficient experience with FFmpeg submissions to know that it is just stupid to work days on something where there's a chance to get rejected anyway, so it was done to be fairly safe but without specific effort on hardening. > You did not do this, and indeed your > implementation was easily exploited. Oh, how do you come to that idea? I have conceded that it's better not to rely on any environment variable - but what you've shown is not an exploit: $ export TMPDIR="'; rm -rf / ;'\\\\" $ ./ffmpeg -sg -i /dev/null -f null - as then you could do $ rm -rf / right away. A system (more precisely: user session) where an attacker has the ability to set arbitrary env variables to arbitrary values must already be considered as compromised. Setting variables like.. LD_PRELOAD, LD_LIBRARY_PATH, LD_AUDIT, PYTHONPATH PATH, SHELL, EDITOR, PAGER, SSH_ASKPASS, GIT_SSH LOCPATH, TERMINFO, ICONV_PATH, NODE_OPTIONS ..is more than enough for an attacker to get anywhere they want and without need to go through an FFmpeg feature Regarding realistic exploitability of this, we are talking about very specific niche cases like for example: - an attacker cannot set arbitrary env variables, but TMPDIR only - and they can control the FFmpeg command line that is executed When these things coincide, then it could be exploited. There are surely other variants, but in total still a very small attack surface (I'm excluding cases with arbitrary env manipulation, because FFmpeg/-sg is not needed for anything then). So, to conclude on this: "easily exploitable" => no way but still a valid point as I had already conceded. --- > My point here is really that I don't believe the security implications of the > patch were considered at all in the initial submission Like said above, I haven't spent extra time on this as I wasn't sure where it might go. The primary consideration for the initial submission was: How to execute? For Windows it was clear, but for Linux I had looked around how others are doing it. Where system was not used, there was always a lot of code involved, which made me afraid for two reasons: 1. I wasn't sure about the range of platform support - i.e. where to draw the lines between one or another implementation 2. I could already visualize the potential objections from others against so much process management code. Eventually, I looked at glibc's system() code, first the latest code using clone or clone3 which I hadn't seen much usages of in the wild, and then I went back to an earlier version (which matches my Ubuntu VM), and I realized that this is pretty much the same code that I'm seeing at other places where shell invocations are done. This seemed perfect to me: same procedure like others use, but with a single line of code. And that's how I knew that using system() is okay. I'm not a frequent Linux platform developer, so I didn't know that people would freak out about it, but I did my homework, which led to the weird situation that I could claim that system() isn't worse than what everybody else is doing while many others were acting like it would be even something that allows privileged execution. Such things can happen, but it should not happen in the way it did, combined with so much disrespect and everything that followed. In the latter regard - again - you have been a shiny exception, and highly appreciate that! PS: This is a perfect finish, so I'll respond to the details in a separate mail. Thank you, 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".
next prev parent reply other threads:[~2025-06-02 6:09 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-05-28 15:24 softworkz . 2025-05-28 17:34 ` Rémi Denis-Courmont 2025-05-28 18:01 ` softworkz . 2025-05-28 18:09 ` softworkz . 2025-05-28 18:27 ` Marton Balint 2025-05-28 18:46 ` softworkz . 2025-05-29 2:59 ` softworkz . 2025-05-29 9:55 ` Nicolas George 2025-05-31 11:44 ` softworkz . 2025-05-31 16:21 ` Mark Thompson 2025-05-31 18:28 ` softworkz . 2025-05-31 20:26 ` Mark Thompson 2025-06-02 6:09 ` softworkz . [this message] 2025-06-02 7:31 ` softworkz . 2025-05-31 16:59 ` softworkz . 2025-05-31 17:34 ` softworkz . 2025-06-01 23:21 ` Michael Niedermayer 2025-06-01 23:51 ` softworkz . 2025-06-02 7:57 ` Nicolas George 2025-06-02 9:31 ` softworkz . 2025-06-02 10:18 ` softworkz . 2025-06-02 10:49 ` Nicolas George 2025-06-02 19:30 ` softworkz . 2025-06-02 21:26 ` softworkz . 2025-06-02 19:34 ` Michael Niedermayer 2025-06-02 21:22 ` softworkz . 2025-06-03 1:06 ` Michael Niedermayer 2025-06-01 23:56 ` softworkz . 2025-05-31 18:38 ` Kieran Kunhya via ffmpeg-devel 2025-05-29 14:43 ` Nicolas George 2025-05-30 3:42 ` softworkz . 2025-05-31 19:31 ` Leo Izen 2025-05-31 19:34 ` Marvin Scholz 2025-05-31 20:08 ` softworkz . 2025-05-31 20:13 ` 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=DM8P223MB03658818BF3571793E34CD49BA62A@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