ALT Linux Distributions development
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: devel-distro@lists.altlinux.org
Subject: [devel-distro] I: mkimage-profiles 1.1.26
Date: Mon, 10 Mar 2014 21:06:53 +0200
Message-ID: <20140310190652.GA14409@osdn.org.ua> (raw)

[-- Attachment #1: Type: text/plain, Size: 1370 bytes --]

	Здравствуйте.
За прошлую неделю в m-p была заметно подтянута документация,
которая по факту не всегда обновлялась коммитами, вносящими
изменения в код (увы).

В фиче deflogin внезапно обнаружилась потенциальная дыра
при текущей реализации функции xport() в lib/functions.mk:
возможно сказать use/deflogin (при этом затребуется экспорт
переменной ROOTPW), не задать никакого значения ROOTPW ни прямо,
ни косвенно и собрать с полученной конфигурацией образ -- это
приводит к гарантированно определённой и пустой GLOBAL_ROOTPW,
что обходит проверку в скриптовом хуке.

Этого можно избежать, если перед экспортированием переменной
проверять её ifdef'ом -- но изначальная реализация (на всякий
прикладываю коммит) не учитывала того, что здесь используется 
отложенное присваивание ('=', а не ':=', в терминах make),
соответственно на момент проверки значения может ещё не быть.

Чтобы сделать по уму -- видимо, придётся выносить экспорты из
генерируемого distcfg.mk в отдельный exportcfg.mk или как его.
И включать уже после сбора конфигурации.

Также в порядке эксперимента добавились ручки к настройкам
слайдшоу (см. http://www.altlinux.org/Branding/slideshow);
для начала сделал use/branding/slideshow/once, работает.

В остальном -- мелкие правки уже наделанного.

-- 
 ---- WBR, Michael Shigorin / http://altlinux.org
  ------ http://opennet.ru / http://anna-news.info

[-- Attachment #2: 0001-sec-lib-functions.mk-ifdef-vars-before-exporting.patch --]
[-- Type: text/plain, Size: 1577 bytes --]

>From 747ae47c53b1f312371730da27bb27732748ac0c Mon Sep 17 00:00:00 2001
From: Michael Shigorin <mike@altlinux.org>
Date: Wed, 5 Mar 2014 21:20:50 +0400
Subject: [PATCH 1/6] [sec] lib/functions.mk: ifdef vars before exporting

xport() would happily yield an _empty_ GLOBAL_VAR
when told to export an _undefined_ VAR by name.

This may result in a security problem when using deflogin feature:
- one can use/deflogin to configure user passwords but not root one;
- ROOTPW is unset (undefined) then but still marked for export;
- distcfg.mk gets "export GLOBAL_ROOTPW = $(ROOTPW)";
- 50-root script hook carefully checks for _unset_ variable
  but it's been _set_ to empty due to the implementation;
- thus empty root password is set instead of not setting it at all
  opening up the system to local unauthorized access
  or local privilege escalation.

Wonder if make-3.82+ behaves differently when setting a variable
to an unset one... it's not the 'undefine' directive in the NEWS.
I must be careful at any rate though.
---
 lib/functions.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/functions.mk b/lib/functions.mk
index 6a3f38c..4364a46 100644
--- a/lib/functions.mk
+++ b/lib/functions.mk
@@ -41,7 +41,8 @@ xport = $(and $(1),$(xport_body))
 define xport_body
 { $(log_body); \
 v='$(1:GLOBAL_%=%)'; \
-printf 'export GLOBAL_%s = $$(%s)\n' "$$v" "$$v" >> "$(CONFIG)"; }
+printf 'ifdef %s\nexport GLOBAL_%s = $$(%s)\nendif\n' "$$v" "$$v" "$$v" \
+	>> "$(CONFIG)"; }
 endef
 
 # if the rule being executed isn't logged yet, log it
-- 
1.8.3.4


                 reply	other threads:[~2014-03-10 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140310190652.GA14409@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=devel-distro@lists.altlinux.org \
    --cc=mike@altlinux.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

ALT Linux Distributions development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/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 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
		devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
	public-inbox-index devel-distro

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-distro


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