-6

Recently I downloaded resources, you can as well call the manuals to use in learning hacking tricks as I embarked on this venture two weeks ago. I have found out that most dangerous code of virus and malicious programs are written in C and C++. And what secret do hackers find in notepad?

closed as unclear what you're asking by Alexander O'Mara, Steffen Ullrich, John Deters, techraf, nealmcb Oct 18 '16 at 1:06

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    "And what secret do hackers find in notepad?": What does that mean? I am not sure I understand what you are asking. – Anders Oct 17 '16 at 10:54
  • 1
    One reason is that compiled C programs can be small and have no external dependencies. – paj28 Oct 17 '16 at 11:34
  • I'm sure you are calling IDE as notepad. C and C++ are not written in notepad. – defalt Oct 17 '16 at 11:40
  • 1
    Bad question. i. There is no correlation between language usage frequency with hacking activities. ii. Because notepad.exe is in every windows PC. hacker book author use it to show the hacking works(and execute and load notepad) – mootmoot Oct 17 '16 at 11:57
4

C is a language that allows direct access to low-level resources. It was originally built to implement the Unix OS, so by its nature it allows you to do things at a system level - which is convenient for exploits.

A consequence of this is that compiled C programs often don't need external dependencies - as is pointed out by paj28 in the comments.

C++ was originally built on top of C, and has the same access to low level operations.

As an example, C allows for direct manipulation of memory through pointers. Once a pointer is created, it can be added to or subtracted from to point at other memory locations. With a little creativity, this can be used for nefarious purposes.

By contrast, Java and C# do not allow this type of manipulation. They do not allow a user to add or subtract to a so-called reference variable (the Java and C# equivalent of C's pointers).

Traditionally, C and C++ are translated directly into machine code, whereas many modern languages such as Java and C# are translated to code for virtual machines (JVM and CIL code). Compilers that translate C and C++ directly to machine code are readily available on almost every platform; less so for compilers that translate Java or C# directly to machine code.

  • You wrote "Once a pointer is created, it can be added to or subtracted from to point at other memory locations. With a little creativity, this can be used for nefarious purposes". Since most of system implement virtual memory, this assertion is quite false: a given process won't be able to go on another process memory space. – binarym Oct 17 '16 at 11:37
  • @binarym I think code can actually escape its boundaries, although it is indeed more difficult due to virtual memory. Like the Venom vulnerability allowed code to escape a virtual machine, vulnerabilities may exist that allow code to go beyond its assigned boundaries. It does require knowledge, skill and the right vulnerability/vulnerabilities on the target. – S.L. Barth Oct 17 '16 at 11:47
  • 2
    You're right, you probably can escape your virtual memory area... but it's a bit more difficult than just playing with pointer :) – binarym Oct 17 '16 at 11:49
  • 1
    @MichaelKjörling True; there have been compilers that translate Java directly into .EXE almost as long as there has been Java. That part was added by editors... I'll consider rewriting it, but may need to remove it. – S.L. Barth Oct 17 '16 at 13:06
  • 1
    Looking at the history, indeed. IMO that edit should have been rejected as addressing the author of the post and not making sense as an edit. – a CVn Oct 17 '16 at 13:24
1

C is already implemented in most Distros and it's a language that grants "deep" access to system ressources which makes it a perfect choise for exploting vulnerabilities. Also, C is well tested and specified.

About the notepad part.. I'm not sure what you mean with that, but I'm using an IDE for that.

  • C is "well specified"? You've got to be kidding. The C spec is filled with examples of undefined or implementation-defined behavior, starting from the binary representation of integers and moving up from there! – a CVn Oct 17 '16 at 12:59
  • @MichaelKjörling I meant C++ with that, I've also added 2 paragraphs but it seems like something with my connection went wrong, as my last edit isn't displayed here – pguetschow Oct 17 '16 at 13:01
  • Stack Overflow: undefined-behavior c++ I rest my case. – a CVn Oct 17 '16 at 13:05
  • @MichaelKjörling Touche. I've never encountered such problems, though. – pguetschow Oct 17 '16 at 13:41
  • you guys am sorry for not being clear. but I find most scripts and manuals written in notepad text editor not IDE. – Ones Oct 18 '16 at 6:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.