From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#27270: display-raw-bytes-as-hex generates ambiguous output for Emacs strings Date: Mon, 25 Apr 2022 09:40:06 +0200 Message-ID: <87fsm17grt.fsf@gnus.org> References: <29d6844f-2f6f-11c1-7877-a9d169e613f8@cs.ucla.edu> <83tw3s8jhr.fsf@gnu.org> <1c05b888-0c4a-05c8-248a-6e550637fff4@cs.ucla.edu> <8737bbxp6a.fsf@users.sourceforge.net> <2d5a8cd8-0884-bc1e-4298-a84dca61acbf@cs.ucla.edu> <831squ8no8.fsf@gnu.org> <93d9c575-4eb2-ea9e-d998-a8f3cff33a1e@cs.ucla.edu> <83y3t271ar.fsf@gnu.org> <83shja6yoq.fsf@gnu.org> <83r2yt7lad.fsf@gnu.org> <2202b54b-606f-0a10-abf7-5cb1a9164897@cs.ucla.edu> <87k0bfsxvk.fsf@gnus.org> <87sfq2d8qi.fsf@gnus.org> <04ac11a4-91a6-00f9-1a12-07e5f62b46b4@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27583"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: v.schneidermann@gmail.com, 27270@debbugs.gnu.org, npostavs@users.sourceforge.net To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 25 09:41:14 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nitLO-0006xo-Fc for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Apr 2022 09:41:14 +0200 Original-Received: from localhost ([::1]:43764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nitLN-0002B0-8F for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Apr 2022 03:41:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nitLC-0002Al-Pc for bug-gnu-emacs@gnu.org; Mon, 25 Apr 2022 03:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nitLC-0004I5-Gs for bug-gnu-emacs@gnu.org; Mon, 25 Apr 2022 03:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nitLC-0007n0-DZ for bug-gnu-emacs@gnu.org; Mon, 25 Apr 2022 03:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Apr 2022 07:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27270 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 27270-submit@debbugs.gnu.org id=B27270.165087242429883 (code B ref 27270); Mon, 25 Apr 2022 07:41:02 +0000 Original-Received: (at 27270) by debbugs.gnu.org; 25 Apr 2022 07:40:24 +0000 Original-Received: from localhost ([127.0.0.1]:33039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nitKZ-0007lv-TF for submit@debbugs.gnu.org; Mon, 25 Apr 2022 03:40:24 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:47466) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nitKX-0007lh-AQ for 27270@debbugs.gnu.org; Mon, 25 Apr 2022 03:40:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2nIoHj/9MJjzbiB+4qVEMT/dcRoeX9sV9TF2B7LsbFI=; b=VEJsQ6QwEXSTnQQ2vrW0X92Htv 0HlGvdyK5Ioh670L5XE0YRb7yYifLZjfSwmkxmEpKH8bo9Hg1w6l6ol3lTswJU0jQHYNCUDFPGRTJ lZstQtPYiC7BCdlEwtzeMGd5AJ5kgwLcqK4U4iKoiqLc4dsi67io7BzbfIJ4reWUYDsI=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nitKM-0007sK-SW; Mon, 25 Apr 2022 09:40:13 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAALVBMVEUEAgMnEyVLGQ5k LRwtDQqGOCK0bkSfWTPFdknclF9qNziPVkr7voUpKSr///8QDAzYAAAAAWJLR0QOb70wTwAAAAd0 SU1FB+YEGQcZGrd1qg0AAAFxSURBVDjL7dHNTsJAEAfwAZZ7eyXZBNcSr0hrN9FLLUtIvAJGrxLK hzeaFDiTtPACwCSe9AlMVF7CAzxA38WVmLC2HAxn57LJ/LL/mewCHK4M/MPfIXMsZMvEOQj5BxDi 0NVauyjcYrovzqYmbzVTfVIN/GAW+fsx5OfM9RdjnAo3BU4dw6gMbirKAbtjASk5CRA3Ihca1htP 7lW/+jCx8/jeTUGbe4j+/dJKQB7n4RMiLo0EZCc4kn1sp7a6w0D2V37iiTXC55NPxEUKCrVeJbRx kXisDBSqY7+E2LGSAIQHfVw0TgC2oKsALp91X6xrDeJt/BvYRcsS5xpQKRslivBeZLlDDfSY0lgB hzAmagMZRamuRAnhXq4NeyCHxzFVfst0hWm5PQkySlc25swgpOS9yhtbnW72YFeYwWzvWQJV9gW4 HTLG7O4p7NZVYclMFnRNCXKIGuX5Db6Kmt9A43ijgLcOvFF5FwWHS9PguPoC7oVs+F7ddOsAAAAl dEVYdGRhdGU6Y3JlYXRlADIwMjItMDQtMjVUMDc6MjU6MjYrMDA6MDCHAqnbAAAAJXRFWHRkYXRl Om1vZGlmeQAyMDIyLTA0LTI1VDA3OjI1OjI2KzAwOjAw9l8RZwAAAABJRU5ErkJggg== X-Now-Playing: Prince's _Sign 'O' the Times (4): Vault Tracks I_: "All My Dreams" In-Reply-To: <04ac11a4-91a6-00f9-1a12-07e5f62b46b4@cs.ucla.edu> (Paul Eggert's message of "Sun, 24 Apr 2022 15:35:53 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:230612 Archived-At: Paul Eggert writes: >> The likelihood of anybody actually encountering this issue is ... small. > > Sure, if strings are random. But strings from opponents aren't random. > > I'll readily grant that it's a much smaller exposure than SQL > injection. Still, like SQL injection it's an exposure and should be > fixed. The opponent would have to get somebody to start an Emacs with -nw, then cut and paste a string with the mouse, then get the user to use the Lisp reader to read that string in again, and then end up with a string that will somehow be a security issue. Comparing this to SQL injection is far fetched, to put it mildly. We have a similar issue with the octal printer -- if you print something out with it, and you end up with something displayed as foo\205bar, you cut and paste that from -nw, and you save it into a file, you end up with a file containing 10 characters instead of 8, and then you have your exploit. I.e., the Lisp reader and strings isn't the only thing confusable here. >> what about (format "%cf" #x9e) > > Since that returns a multibyte string, I suggest "\u009ef" which is > multibyte. For its unibyte counterpart (encode-coding-string (format > "%cf" #x9e) 'iso-latin-1) I suggest the syntax "\x9e\ f" which is > unibyte. (These are not the only possibilities; for example, the > former could be "\u009e\ f" if you think that's clearer.) display-raw-bytes-as-hex is a display setting. You want to change it so that the data output will be different, which will break all kinds of things, even if (when you use the Lisp reader) it'll end up being the same. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no