如何保护我的 ASP.Net 源代码免受开发人员的侵害

发布于 2024-07-27 19:04:52 字数 374 浏览 4 评论 0原文

这似乎是一个奇怪的立场,但无论如何让我问这个问题。

我创建了一些 DLL,它们可以执行一些神奇的繁琐操作,以显示我现在在 ASP.Net 中制作的网站的内容。 我有一个小开发团队可以帮助我解决这个问题,但我担心他们离开我的公司后会窃取我的代码(DLL)并在项目中使用它。 在软件中,我可能可以证明他们正在使用我的 DLL 来生成内容,但在 DLL 不向公众开放的服务器上,我无法证明。

因此,尽管有一个团队,但我一直在独自完成这件事。

我的问题是。 您是否可以想到使用任何方法来保护我的 DLL(它位于 bin 文件夹中),以便我的编码人员无法窃取它,或者如果被盗,它将变得无法使用。

我只是想保护 bin 文件夹中的所有内容。

This seems like a weird position to be in, but let me ask the question anyway.

I have created some DLLs that do some magical mumbo-jumbo that is needed to display the content for the website I am making right now in ASP.Net. I've got a small team of developers who can help me with this, but I am afraid that they will steal my code (the DLL) and use it in projects when they leave my company. In a software I can probably prove that they are using my DLL to generate the content, but on a server where the DLLs are not available to public I can't.

So in spite of having a team I've been working on this all alone.

My question is. Is there any way you can think of using which I can protect my DLL (which goes into the bin folder) so that my coders can't steal it, or it becomes unusable if stolen.

I just want to protect whatever goes into the bin folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

坚持沉默 2024-08-03 19:04:52

如果环境感觉不舒服,您可以让 dll 检查其环境并无法工作(我建议您让它给出错误的结果而不是中断)。 您还必须混淆代码以阻碍消除保护的努力。

编辑:您可以使用环境变量、注册表项、性能计数器的存在、machine.config 中的模糊设置等,并使其看起来像真实的设置,然后进行模糊处理并使用强名称进行签名。

You could have the dll check its environment and fail to work (I suggest you make it give wrong results rather than break) if the environment does not feel like home. You will also have to obfuscate the code to hamper efforts to remove the protection.

Edit: you could use an environment variable, registry key, existence of a performance counter, an obscure setting in machine.config, etc., and make it look like a genuine setting, then obfuscate and sign with a strong name.

一袭白衣梦中忆 2024-08-03 19:04:52

这可能不适合您的情况,但您可以为他们提供一个代理 DLL,该代理 DLL 不执行计算,而是调用您的 DLL。

然后,您将 DLL 保存在另一台只有您有权访问的服务器上,代理 DLL 通过某种远程协议调用它。

This may not be appropriate to your situation but you could provide them with a proxy DLL which doesn't perform the calculations but instead calls your DLL.

You then keep your DLL on another server that only you have access to and the proxy DLL calls it via some sort of remoting protocol.

小兔几 2024-08-03 19:04:52

这是一个奇怪的处境……我表示哀悼。

在 .Net 级别,您能做的最好的事情就是在构建代码时对其进行混淆。 强烈签署您的程序集会让您知道是否也发生了篡改。

有些人采取的另一种方法是用 C++ 编写真正敏感的代码并将其编译为非托管 .dll,然后使用互操作从 .net 调用它。 C++ 字节码比 IL 更难阅读,这给简单的逆向工程带来了更多障碍。

编辑:根据 OP 的评论,这是更新的答案。

如果您只是担心他们窃取您放置在 Web 服务器上的 bin 文件夹中的 DLL,只需将其发布到\bin 的子文件夹,使用 Windows 权限锁定该文件夹,这样他们就无法进入它,并更改您的 web.config 来探测它。

<runtime>
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin\mysubfolder;" />
   </assemblyBinding>
</runtime>

一定要确保对 .dll 进行强命名,并将您的私钥文件保存在安全的地方。 这使得您的 .dll 具有唯一可识别性,并且如果他们确实篡改了它,就可以检测到。

That is a weird position to be in... my condolences.

At the .Net level, the best you can do is obfuscate your code when you build it. Strongly signing your assembly will let you know if tampering is going on as well.

Another approach that some people have taken is to write the really sensitive code in C++ and compile it to an unmanaged .dll, and call into it from .net using interop. C++ bytecode is much harder to read than IL, and this throws up a lot more barriers to easy reverse-engineering.

Edit: based on comments from the OP, here is an updated answer.

If you're simply worried about them stealing the DLL that you place in the bin folder on your web server, simply publish it to a subfolder of \bin, lock the folder down using windows permissions, so there is no way they can get into it, and change your web.config to probe it.

<runtime>
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin\mysubfolder;" />
   </assemblyBinding>
</runtime>

Definitely make sure to strongly name the .dll, and keep your private key file somewhere safe. That makes your .dll uniquely identifiable and tampering can be detected if they do get at it.

万劫不复 2024-08-03 19:04:52

相关:https://stackoverflow.com/questions/181991/suggest-a-良好的网络封闭混淆器
您可能想有选择地混淆您的代码(保持公共 API 不变)

Related: https://stackoverflow.com/questions/181991/suggest-a-good-obfuscator-for-net-closed.
You might want to obfuscate your code selectively(keep public API's as is)

人生百味 2024-08-03 19:04:52

您可以让 dll 与受信任的第三方(可能是您可以控制的服务器)进行一些握手以确保它应该运行。

沿着编辑思路的一些东西

A. Hey, I'm sitting at [hostname->taken from env vars], can i do my job?
B. (checks records of registered hosts)  Yes you can.
A. Thanks.  (does what it does best)


当然,如果其他人知道你正在这样做,他们可以将远程地址绑定到他们选择的机器......此时你还没有真正解决原来的问题。

You could have the dll talk to a trusted third party (which would probably be a server you would have control of) to do a little hand-shaking to make sure it's supposed to run.

Something along the lines of

A. Hey, I'm sitting at [hostname->taken from env vars], can i do my job?
B. (checks records of registered hosts)  Yes you can.
A. Thanks.  (does what it does best)

edit:
Of coarse, if someone else knows you're doing this, they could bind the remote address to a machine of their choosing... at which point you haven't really fixed your original problem.

轻拂→两袖风尘 2024-08-03 19:04:52

我对印度的法律体系不太了解,但请确保让他们签署某种形式的保密协议,并向他们明确表示你会认真对待这一问题,如果他们违反,你将起诉他们。

如果可能的话,仅通过 Windows 服务或进程外 COM 服务器公开您的 DLL,以便您可以将您的 DLL 隔离在他们无法直接访问的地方。

如果他们可以物理访问您的 DLL,并且他们是半称职的开发人员,那么从技术角度来看,您可能无法真正阻止他们使用它。 您可以稍微放慢他们的速度,但如果他们能够访问二进制文件,他们将不可避免地得到他们想要的东西。 拒绝他们访问二进制文件是防止这种情况的唯一有效方法。

但是,如果 DLL 以任何方式处理用户输入并提供要显示的内容作为结果,那么您可以放入某种“复活节彩蛋”,该彩蛋将根据一些模糊但特定的输入输出某种不同的签名。 取决于可能足以展开调查并迫使他们授予调查人员访问权限的法律制度,以证明他们没有窃取您的技术。 除非他们知道它在那里,否则他们可能不会在您有机会调用它之​​前查找它并禁用它。

I don't know much about the legal system in India, but make sure you get them to sign some form of NDA, and make it clear to them that you take it serious and will sue them if they violate it.

And if possible only expose your DLL through a Windows Service or out-of-process COM server so that you can isolate your DLL where they cannot access it directly.

If they have physical access to your DLL, and they're halfway competent developers, then there probably isn't much that you can really do from a technology standpoint to actually prevent them from using it. You can slow them down a bit, but inevitably they will get what they want if they have access to the binary. Denying them access to the binary is the only effective way to prevent it.

However, if the DLL processes user input in any way and provides content to display as a result, then you can put in some kind of "Easter Egg" that will output a distinct signature of some kind based upon some obscure but specific input. Depending on the legal system that may be good enough to open an investigation and force them to grant access to investigators to prove that they're not stealing your tech. Unless they know it's there they probably won't look for it and disable it before you have a chance to invoke it.

橘和柠 2024-08-03 19:04:52

我会在安全服务器上创建一个 Web 服务,该服务将公开您的 dll 的功能。 开发完成后,您可以更改调用 Web 服务的代码部分以直接调用 dll。

I would create a web service on a secured server that would expose the functions of your dll. Once development is done you could change the parts of the code that call the web service to call the dll directly.

风情万种。 2024-08-03 19:04:52

我同意 LachlanG 的策略,即分发代理 DLL,而不是让开发人员访问很容易被破解和逆向工程的生产版本。

您可以探索的另一个选项是“加密狗”保护您的 DLL。 我在研究我的问题的解决方案时偶然发现了你的问题。 我正在探索这个选项,因为我处于相同的位置,但使用更容易受到攻击的基于 PHP 的解决方案。

我发现 Keylok 以实惠的价格提供了具有竞争力的产品,我正在强烈考虑这一点。 目前还不清楚如何保护 PHP 中的 API 调用,因为 PHP 代码不是二进制的,也不是混淆的。 我预计 DLL 不会出现任何问题。

我是一家公司的项目经理,该公司使用此类加密狗保护他们的 SAP 集成软件。 最终产品是一张包含代码、安装手册、加密狗和 20 万美元许可证费用的 CD。 甜甜的!!! 已经过去10年了,我还没有听说他们有任何盗版或侵犯版权的故事!

我希望这有帮助。

I concur with LachlanG's strategy to distribute a proxy DLL instead of giving your developers access to the production one that could easily be cracked and reversed engineered.

Another option you can explore is to "dongle" protect your DLL. I stumbled with your question while researching a solution to my problem. I am exploring this option since I am in the same spot but with even more vulnerable PHP based solution.

I found that Keylok offers a competitive product at an affordable price that I am strongly considering. It's yet to be seen how to protect the API calls in PHP which code is not binary nor obfuscated. I dont foresee any problem with a DLL.

I was a project manager for a company that protected their SAP integration software with these kind of dongles. The final product was a CD with the code, the installation manual, the dongle and a license bill for $200k. Sweeet!!! It was 10 years ago, and I have not heard of any piracy or copyright infringement stories from them yet!

I hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文