Saturday, December 11, 2010
UnSafe Code
By default, Microsoft’s C# compiler produces safe code. Safe code is code that is verifiably safe. However, Microsoft’s C# compiler allows developers to write unsafe code. Unsafe code is allowed to work directly with memory addresses and can manipulate bytes at these addresses. This is a very powerful feature and is typically useful when interoperating with unmanaged code or when you want to improve the performance of a time-critical algorithm.
However, using unsafe code introduces a significant risk: unsafe code can corrupt data structures and exploit or even open up security vulnerabilities. For this reason, the C# compiler requires that all methods that contain unsafe code be marked with the unsafe keyword. In addition, the C# compiler requires you to compile the source code by using the /unsafe compiler switch.
When the JIT compiler attempts to compile an unsafe method, it checks to see if the assembly containing the method has been granted the System.Security.Permissions.Security Permission with the System.Security.Permissions.SecurityPermissionFlag’s SkipVerification flag set. If this flag is set, the JIT compiler will compile the unsafe code and allow it to execute. The CLR is trusting this code and is hoping the direct address and byte manipulations do not cause any harm. If the flag is not set, the JIT compiler throws either a System.InvalidProgramException or a System.Security.VerificationException, preventing the method from executing. In fact, the whole application will probably terminate at this point, but at least no harm can be done.
Subscribe to:
Post Comments (Atom)
What happens when third party dot net dlls are used? In what way can we check the dlls are calling unsafe methods or not? Do we have tools that inspect the third party dlls for checking any security vulnerabilities?
ReplyDeletethanks
DeleteGood questions Srini, as usual. To take control, Security.Permissions namespace helps as indicated in the last para. In terms of tools, there are few tools like Axivion, Lanquard, DLLHijackAuditor in the market. But, I would recommend to learn from Microsoft's security tech blog 'http://blogs.technet.com/b/srd/' for latest frequent updates.
ReplyDeleteThanks for sharing with us.
ReplyDeleteAngularjs Training in Chennai
my pleasure
DeleteIt’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
ReplyDeleteDevops Course Training in Chennai |Best Devops Training Institute in Chennai
Selenium Course Training in Chennai |Best Selenium Training Institute in Chennai
Java Course Training in Chennai | Best Java Training Institute in Chennai
thanks jefrin
DeleteAnd indeed, Iam just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I have had.
ReplyDeleteDotnet Training in Chennai
Matlab Training in Chennai
Embedded Training in Chennai
SAS Training in Chennai
Powerbi Training in Chennai
R Programming Training in Chennai
Javascript Training in Chennai
Oracle DBA Training in Chennai
RPA Training in Chennai
UIpath Training in Chennai
Big Data Hadoop Training in Chennai
Linux Training in Chennai
Cloud Computing Training in Chennai
Software Testing Training in Chennai
Blue Prism Training in Chennai
Angularjs Training in Chennai
MCSE Training in Chennai
AI Training in Chennai
SEO Training in Chennai
nice Karthick
DeleteAnd indeed, Iam just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I have had.
ReplyDeleteBest Dotnet Online Training in Chennai
Best Matlab Online Training in Chennai
Best Embedded Online Training in Chennai
Best SAS Online Training in Chennai
Best Powerbi Online Training in Chennai
Best R Programming Online Training in Chennai
Best Javascript Online Training in Chennai
Best Oracle DBA Online Training in Chennai
Best RPA Online Training in Chennai
Best UIpath Online Training in Chennai
Best Big Data Hadoop Online Training in Chennai
Best Linux Online Training in Chennai
Best Cloud Computing Online Training in Chennai
Best Software Testing Online Training in Chennai
Best Blue Prism Online Training in Chennai
nice to hear /Riyas
DeleteAnd indeed, Iam just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I have had.
ReplyDeleteAdvanced Dotnet Training in Chennai
Advanced Matlab Training in Chennai
Advanced Embedded Training in Chennai
Advanced SAS Training in Chennai
Advanced Powerbi Training in Chennai
AdvancedR Programming Training in Chennai
Advanced Javascript Training in Chennai
Advanced Oracle DBA Training in Chennai
Advanced RPA Training in Chennai
Advanced UIpath Training in Chennai
Advanced Big Data Hadoop Training in Chennai
Advanced Linux Training in Chennai
Advanced Cloud Computing Training in Chennai
Advanced Software Testing Training in Chennai
Advanced Blue Prism Training in Chennai
great to know
DeleteHi, Honestly, it's a Nice Article
ReplyDeleteIf you are looking for the best Cloud Solutions that will be helpful for your business. We provide efficient methodologies for the successful implementation of Cloud computing business solutions | cloud computing companies in Madhapur | Cloud Computing Services in Madhapur | cloud computing companies in Hyderabad | cloud computing services companies in India | cloud computing solutions companies.
Thank you!
thanks
Deletehard to understand
ReplyDeletecan't read
ReplyDeleteThanks for your informative articel .its very useful
ReplyDeleteVisit us: Dot Net Online Training
Visit us: Dot Net Online Course
unknown
ReplyDeletegood to know
ReplyDeleteglad that it helped you
ReplyDeletethanks
ReplyDeletesmm panel
ReplyDeleteSmm Panel
İs ilanlari blog
İnstagram takipçi satın al
HİRDAVATCİ
beyazesyateknikservisi.com.tr
Servis
tiktok jeton hilesi
تسليك مجاري
ReplyDeleteتنظيف سجاد
تسليك مجاري
ReplyDeleteتنظيف سجاد
تسليك مجاري
ReplyDeleteتنظيف سجاد
تسليك مجاري
ReplyDeleteتنظيف سجاد
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
تركيب اثاث ايكيا
ReplyDeleteشراء اثاث مستعمل
Hello, thank you for sharing your knowledge.
ReplyDeleteThis is a fantastic and very helpful essay.
I appreciate you offering this information, and I wish everyone who chooses to participate luck. Linux Online Training - NareshIT
Happy to hear it
Delete
DeleteHi,
I really appreciate you sharing this knowledge, so thank you so much.
It is a useful and stylish item.
You're welcome to share this information with anyone who might be interested. Linux Online Training - NareshIT
Good day, hello.
ReplyDeleteIt's been fun working with you.
This item combines both beauty and utility.
Thank you for making this information available to anyone who wish to participate. Linux Online Training - NareshIT
ReplyDeleteHi Nice Blog, Thanks for Sharing this Post Linux Online Training - NareshIT
This is a great article. I found the information provided to be very insightful and informative. It's always refreshing to come across well-written content that offers valuable insights.
ReplyDeleteAWS Training in Electronic City Bangalore
thank you
DeleteIts Very Use Full Information , Keep Posting Blogs Of HTML | CSS | JavaScript , For More Information Search HTML CSS JavaScript Online Training , Thanking You
ReplyDeletethanks
Delete