请参阅传递给程序的命令行参数

时间:2012-11-07 22:33:55

标签: c# security arguments command-line-arguments truecrypt

您可以跳过此部分

  

我正在使用我的拇指驱动器中的批处理文件   安装一个真正的密码卷。我借助于创建了该批处理文件   this link。在该批处理文件中,我有用户名和密码   我作为参数传递给trueCrypt.exe以便它   安装。


无论如何,我的问题是:是否可以看到从第三方进程传递给程序的参数?换句话说,是否可以看到传递给该程序的参数:

using System;
using System.Reflection;
using System.Diagnostics;

class Program
{
    static string password = "";

    static void Main(string[] args)
    {
        if (args.Length > 0)
            password = args[0];

        // get location where this program resides 
        var locationOfThisExe = Assembly.GetExecutingAssembly().Location;


        Console.Write("Press enter to start a new instance of this program.");
        Console.Read();

        var randomArgument = new Random().NextDouble().ToString();
        Process.Start(locationOfThisExe, randomArgument); 
        // I am passing a random argument to a new process!
        // is it possible to see these arguments from another process?
    }
}

修改

我正在创建编辑原因我认为我自己解释不正确,但此编辑应该是解决方案而不是问题

我认为这个问题没有得到足够的重视。执行https://stackoverflow.com/users/235660/alois-kraus显示的命令显示:

(我将输出粘贴在记事本++上)

enter image description here

在图像上它没有非常清楚地显示,但我能够看到参数传递给该过程。 这对我很重要,因为我使用以下命令安装我的真正的密码卷:

“C:\ Program Files \ TrueCrypt \ TrueCrypt.exe”/ v“a:\ volume.tc”/ lz / a / p a

告诉truecrypt我要在驱动器号z上安装位于a:\volume.tc的卷,密码为a

如果我执行该命令,则真正的crypt将在驱动器z上挂载该卷:

enter image description here

问题是,如果我然后执行命令wmic process注意什么鞋子:

enter image description here

请注意密码在那里!

总而言之,将安全信息作为参数传递是不安全的。如果你关闭接收参数的过程可能是安全的,但我认为重要的是要注意这一点...

1 个答案:

答案 0 :(得分:2)

如果具有管理权限或具有相同用户帐户的其他用户可以执行程序,则可以使用

查看所有命令行
wmic process
使用此单个命令行从所有进程

相关问题