Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • fusiondirectory fusiondirectory
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 39
    • Issues 39
    • List
    • Boards
    • Service Desk
    • Milestones
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • fusiondirectoryfusiondirectory
  • fusiondirectoryfusiondirectory
  • Issues
  • #4875
Something went wrong while setting issue due date.
Closed
Open
Issue created 8 years ago by bmortier@bmortierMaintainer
  • New related issue

  • New related issue

Hooks can lead to arbitrary code execution

Closed

Hooks can lead to arbitrary code execution

Bonjour,

Pouvez-vous envoyer les arguments au script définit en pre-check entre guillement svp ?

Ex : check-password.pl "motdepassedelamortquitue"

(from redmine: issue id 4875, created on 2016-06-13, closed on 2016-06-23)

  • Relations:
    • relates #4898
  • Changesets:
    • Revision e6ff8973 on 2016-06-23T02:41:19.000Z:
Fixes #4875 escaping shell arguments when calling hooks
  • Revision 2f3aa001 on 2016-06-23T02:42:13.000Z:
Fixes #4875 escaping shell arguments when calling hooks
  • Custom Fields:
    • Bug in version: 1.0.12

    Tasks

    0

    No tasks are currently assigned. Use tasks to break down this issue into smaller parts.

    Linked items
    0

    Link issues together to show that they're related. Learn more.

    Activity


    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      hello,

      i'am not sure about this, lets talk to the developper :)

      Cheers

      (from redmine: written on 2016-06-16)

      By bmortier on 2017-09-02T15:30:00 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      For me this should not be changed as it would break existing hooks. Also the same behavior is used for placeholders in hooks and templates and we obviously do not want to have templates full of "" in each field so I’m not sure how easy it would be to implement.

      And, in some cases, it can be useful to be able to quote where the user wants, for instance: @echo "user %cn%(%uid%) has been modified" > /tmp/somelog.txt@

      (from redmine: written on 2016-06-22)

      By Côme Chilliet on 2017-09-02T15:30:00 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      Ok, so i'm facing a problem

      My script check for the "force" of password, each password can contains ';' or '>' or '#' and '!'. This cause lots of trouble when the script is executed and in fact somebody can play with my server... imagine if the password entered is "a; touch /tmp/t"

      /usr/share/fusiondirectory/script.pl a; touch /tmp/t

      Lots of fun ...

      (from redmine: written on 2016-06-22)

      By amichon on 2017-09-02T15:30:00 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      In fact, add " will not solve the problem

      (from redmine: written on 2016-06-22)

      By amichon on 2017-09-02T15:30:00 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      Indeed this is a big problem, even if the user uses quotes, if the attacker enter a closing quote he can execute code. We should use http://php.net/manual/en/function.escapeshellarg.php on placeholders final values before running any hook. But this means people must not put quotes in their hooks, and they won’t be able to do things like «@echo "%value1% %value2%" > /tmp/somefile@» for instance. But I don’t see any way to prevent attacks and still allow this kind of thing as the escaping is not the same one depending of type of quotes used. We could add escaping only as a modifier but most people would forget to put it and expose themselves. Maybe we can do the opposite and have a modifier to prevent escaping in special cases.

      (from redmine: written on 2016-06-22)

      By Côme Chilliet on 2017-09-02T15:30:01 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      hello,

      yes i wote for escaping always and have a special modifier if people want to be exposed :)

      And of course i always advised people not to put quote inside the command in the hooks section, better put the quote inside the script

      Cheers

      (from redmine: written on 2016-06-22)

      By bmortier on 2017-09-02T15:30:01 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      Patching : ok

      I have done two or three tests, all are working in the right way :

      • a; touch /tmp/z; : ok
      • true password : ok
      • false password : ok (false means using toto as password)
      • random letter and special character : ok

      (from redmine: written on 2016-06-23)

      By amichon on 2017-09-02T15:30:02 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      The patch is now using in production environnement.

      (from redmine: written on 2016-06-23)

      By amichon on 2017-09-02T15:30:02 (imported from GitLab)

    • bmortier
      bmortier @bmortier · 8 years ago
      Author Maintainer

      Close issue

      (from redmine: written on 2016-06-23)

      By Jonathan Swaelens on 2017-09-02T15:30:02 (imported from GitLab)

    • bmortier closed 7 years ago

      closed

      By Jonathan Swaelens on 2017-09-02T15:30:03 (imported from GitLab)

    • bmortier added Security label 6 years ago

      added Security label

      By bmortier on 2018-09-28T19:38:53 (imported from GitLab)

    • bmortier removed Bugs Security labels 4 years ago

      removed Bugs Security labels

    • bmortier added Security fusiondirectory-core labels 4 years ago

      added Security fusiondirectory-core labels

    • bmortier added FSA-0010 label 4 years ago

      added FSA-0010 label

    • bmortier added FSA-0009 label and removed FSA-0010 label 4 years ago

      added FSA-0009 label and removed FSA-0010 label

    Please register or sign in to reply
    Assignee
    bmortier's avatar
    bmortier
    Assign to
    Labels
    0
    None
    0
    None
      Assign labels
    • Manage project labels

    Milestone
    No milestone
    None
    Due date
    None
    None
    None
    Time tracking
    No estimate or time spent
    Confidentiality
    Not confidential
    Not confidential

    You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

    Lock issue
    Unlocked
    0
    0 Participants
    Reference:

    Menu

    Explore Projects Groups Topics Snippets