Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++]

The C++ programming language

-1
votes
0answers
15 views

Constant-time code [migrated]

I have two pieces of code snips, which should be investigated on fulfilling the constant-time requirement. If it is not fulfilled, the code should be revised. First: unit8_t a[128] unit8_t data[128]...
2
votes
1answer
71 views

How to programatically verify a file signature?

I have a dll file signed with my private key, here is the signature info in Windows Explorer: Now, using the public key found in the certificate, how can I verify the integrity of the file? I am ...
0
votes
1answer
90 views

Does hashing a file consider its digital signature as well?

I have a signed (using Windows signtool) executable which is hashed by SHA1 algorithm and encrypted using RSA. Now I like to verify the executable to avoid security vulnerabilities. For that I have an ...
2
votes
1answer
105 views

C++ binary obfuscation: how to get around license checks being a simple if/then branches?

I'm looking into binary obfuscation for an exectuable binary written in C++. I realize preventing cracks is impossible, but making it slightly harder would be nice. No matter how complex the actual ...
2
votes
0answers
69 views

How to obfuscate C++ code with movfuscator?

I want to obfuscate a C++ application using movfuscator, but movfuscator currently uses C as the source language and not C++. I tried to do the followings (as they recommended, but with no success): ...
3
votes
1answer
114 views

What do you search for in Open Source code to be sure there isn't malicious code?

I realize the answers will be language specific, but I am curious what terms you would look for when checking something out on Github? I was looking for a remote administration tool that I could use ...
0
votes
1answer
97 views

SAT (Satisfiability) it is security risk?

If researcher found satisfiability in any software, this is a threat to security? If answer - "Yes", how can attacker to use SAT?
1
vote
1answer
62 views

is it possible to craft exploits for non-open source C/C++ software without fuzzing?

imagine that if i wanted to find a vulnerability in a program that is used by a lot of people in order to exploit it. the program is open source and is written in C/C++ . would this even be possible ...
0
votes
1answer
113 views

over 100 scanner requests 5 min after domain registration

First off, I am no security expert! Yesterday I registered a .cf domain, I needed it for about 10 minutes. About 5 minutes after domain registration I got over 100 scanner requests (I checked all ...
3
votes
1answer
201 views

strstr and fopen, is there a bypass?

I have a binary that does this: if (strstr(USERCONTROLLERSTRING, "..")) exit; fopen(CurrentPath+"\\Data\\"+USERCONTROLLEDSTRING, "r"); then spits out all the content of the file. Is there any ...
0
votes
1answer
59 views

Key distribution from a central server [closed]

I have a system composed by different computers that must communicate in a real-time context. All the communications must be encrypted and this system is not connected to Internet, it's just a bunch ...
1
vote
0answers
44 views

Can I get functions addresses from CaptureStackBackTrace?

I'm trying to hook some functions in a static linked executable and I have to get a pattern for the function in almost every new version of the program as the function is quite big so the compiler ...
1
vote
1answer
65 views

Best way to secure Telegram Token in program?

My program (written in C++) utilizes a telegram bot for sending me status messages. For being able to do that it needs the bot token (a simple string), something which I prefer to keep private. This ...
0
votes
0answers
85 views

Protect client app in online game from cheating?

I'm working on a multiplayer game (mix of RPG and Strategy) for Windows using C++, that's going to be released on Steam. I want to make the client .exe application secure as much as possible. Please ...
-2
votes
1answer
71 views

If I put a variable in the private section of a class, will the variable have more protection againsted reverse engineering? [closed]

class LockdownUnlock{ private: /*snip*/ std::string rootCertificate; //Will this protect the data? /*snip*/ public: /*snip*/ }LDUnlock;
0
votes
1answer
54 views

Compiler Parameters to isolate a C++ program

Is there any set of compiler parameters that can be used to prevent a C++ program from having any access to most system functions, leaving it with access to read/write to stdin/stdout, but otherwise ...
0
votes
1answer
657 views

How to generate CSR(Certificate Signing Request) using C++ and openssl [closed]

I am new to openssl. I am trying to implement the program to generate CSR using openssl and c++. I need to implement the following commands using C++. openssl req -new -newkey rsa:1024 -nodes -keyout ...
4
votes
2answers
541 views

Can 4 single quotes still be escaped producing a sql injection on sql server? [duplicate]

I found a simple breakout in a where clause in one of our projects where the code is so old that they claim they can't use parameters to communicate with ms SQL server. It's written in C++, I can't ...
1
vote
2answers
803 views

Buffer overflow due to strlen, strcpy, strcat

I'm new to secure code review. I know that strlen will calculates the length until it finds a null character. This is a part of a larger code. char* executeMount(char* password, char* path, int ...
0
votes
0answers
151 views

Can an uncaught exception lead to shellcode execution in c++?

In the book "Practical malware analysis" on page 447 the following is stated. Unlike exception handling in 32-bit systems, structured exception handling in x64 does not use the stack. In 32-bit ...
1
vote
0answers
406 views

Microsoft CryptoAPI FIPS 140-2

My customer asks me to use FIPS 140-2 validated cryptographic libraries. Currently I have AES 256 encryption using Microsoft CryptoAPI in my application. First I get the provider (HCRYPTPROV) using ...
1
vote
2answers
605 views

C++ standard library use in malware

I was recently analyzing the sources of ZeuS, ZeroAccess, Carberp and other professional malware and there was one thing which I found weird: The authors did not use the standard library std::-...
1
vote
1answer
95 views

How to make a file detected by anti virus

I know this question is kind of stupid but I am testing a virus database and I would like to know any kind of code in c++ or C#/VB.net that would be detected as virus by an antivirus, without actually ...
0
votes
3answers
389 views

Do I need to run security on sockets in C++?

I was reading up on how to make two programs talk to each other on my machine, and I saw the option to use sockets. One website suggested that sockets are entirely internal, so that seemed to suggest ...
1
vote
1answer
330 views

One-Time-Password securing an embedded server via OpenSSL

I am developing an application to secure communications between a client and an embedded linux server. I am very new to the field of cryptography, so at this stage I am looking more for guidance - ...
0
votes
2answers
1k views

some vulnerable projects in C or C++ for a lecture

I'm looking for some real projects which have stack overflow vulnerabilities. The important thing is, I am going to teach finding the vulnerabilities and the way of fixing them by these examples. So, ...
4
votes
2answers
294 views

Client-Server Authentication Security Issue

This is a repost, because i accidentialy posted on stackoverflow first I was wondering how i could achieve a high security level, using Client-Server Authentication. Below is a rough draft of what i ...
0
votes
1answer
112 views

Are Optimization Flags Harmful?

There seems to be a consensus, that -D_FORTIFY_SOURCE=2 -O1 is a hardening measure that should be applied as compiler option. This was also a recommendation in the Dovecot Pentest Report. What I'm ...
1
vote
1answer
680 views

Crack AES ECB mode C++

I have this little piece of code for encrypting: typedef unsigned char byte; int encrypt(char *filename) { byte key[ 16 ]; int i; memset( key, 0x00, 16); for(i=0;i<=sizeof(*key);...
1
vote
0answers
31 views

SendMessage security

I have a C++ app that registers a global CBT hook. However, when my program exits, I want to deregister the hooks and also unload the DLL that registered them so that it can be replaced by an updater ...
4
votes
1answer
2k views

How does using unsigned integers protect against integer overflow attacks?

In order to avoid problems with integer overflow in C or C++, some people have suggested to use unsigned integers. How can this protect against possible overflow attacks? Doesn't an unsigned integer ...
39
votes
3answers
5k views

What security measure one should implement before executing user uploaded files?

I want to make a little programming puzzle on my website. There's going to be a task. The user will be asked to upload a C++ source file with their solution. The file should be compiled, run with some ...
0
votes
2answers
122 views

Which approach to use to implement encryption in a Windows desktop app?

I will need to do some encryption of the user data in my Windows desktop application, written in C/C++ using WinAPIs (no .NET or WinRT stuff.) Namely, I'll be doing the following: Symmetric ...
3
votes
1answer
100 views

How can I check my program for vulnerabilities over TCP?

I made a program which runs constantly on a linux server (Program A). I also created another program which acts as user interface for A (Program B). A listens for incoming connections over TCP. After ...
2
votes
2answers
1k views

How does malware load a dll from memory

I am trying to understand how malware loads a dll from memory, like from a resource section. I am seeing codes all over google but i cant find sort of a pseudocode like in simple english that can ...
1
vote
1answer
283 views

protect c ++ application via an automatic hardware binding

I have a Qt App which is running on a raspberry pi (Debian Wheezy). The raspberry image is autogenerated via a python script: - Get the latest version of the generic custom-raspi-image - Mount the ...
-1
votes
1answer
436 views

How to exploit a wesbite using C++ for backend? [closed]

There are a lot of major sites like google and ebay that use C++ or C on the backend. I managed to find a buffer overflow on a random major website in a pentest. However it is a buffer overflow on x64 ...
0
votes
1answer
501 views

How do hackers obtain the memory addresses of variables?

I've seen countless tutorials on hacking telling you that all you need to do is find the memory address of a variable and edit it, the problem is, they never explain how to do it. I'm not one for ...
2
votes
1answer
446 views

How to implement ECDHE-RSA-AES256-GCM-SHA-2 communication in OpenSSL?

Full question How do you implement client and server based solution-pair to secure network communication for simple C++-based desktop (non-browser) programs utilising the ECDHE-RSA-AES256-GCM-SHA-2 ...
1
vote
1answer
787 views

Why local variable is not overwritten due to buffer overflow?

Here is the my C++ program in which buffer overflow happened, still the local variable is not corrupted: #include <iostream> #include <cstring> using namespace std; int main() { // ...
1
vote
1answer
338 views

C++ : memset on a struct containing std::wstring - Is it a risk?

While reviewing a piece of C++ code I came across instances (reported by CPPcheck) where memset() was used on structures containing string members. I have come across a few references that talk about ...
-2
votes
1answer
292 views

How to encrypt a file? [closed]

I created my own encrypt / decrypt script and I can encrypt any kind of strings. I just need to know how can I use my script to encrypt a file like an image or a text file? My script is working in ...
1
vote
1answer
479 views

How to use a different key and IV for encrypting a file with AES in C++?

I know how AES encryption works, and different modes (for example EAX, CBC, CCM, ...), and also about CipherBlock and StreamTransformationFilter methods and their implementation in C++. I am using ...
5
votes
1answer
523 views

Protecting master password in memory

Assuming I want to enter master password only one time at the start of the program, how is this master password usually protected in memory after that? Is the encryption key after being derived from ...
0
votes
0answers
211 views

Why SMIME decryption works with sender and recipient private key?

Im developing an application, that needs to use SMIME encryption and authentication. I've implemented a decryption system, and am currently testing it. I send the emails with another fully working ...
5
votes
2answers
692 views

Is it possible to crack g++ rand()?

So, I have this: I know that some code was used to generate a random sequence, and it looked roughly like this: #include <iostream> #include <string> int main() { const std::string ...
2
votes
0answers
260 views

Creating a dynamic malware analysis environment

I don't know much about malware analysis so why this question here. I have analysed Short cut virus statistically and its impact on USB drives and wrote a code to repair its damage. My static ...
1
vote
1answer
563 views

Is reseeding OpenSSL CSPRNG necessary if using RAND_bytes?

I read that cryprographic secure PRNG (CSPRNG) need a random seed to provide random output. Looking at OpenSSL that seems to be archived by RAND_poll() and random data is fetched with RAND_bytes(buf, ...
131
votes
8answers
22k views

Why are programs written in C and C++ so frequently vulnerable to overflow attacks?

When I look at the exploits from the past few years related to implementations, I see that quite a lot of them are from C or C++, and a lot of them are overflow attacks. Heartbleed was a buffer ...
4
votes
0answers
103 views

Are there any C++ STL alternatives which is bulletproof against timing attack?

Just out of curiosity, I wonder if there are any packages of popular algorithm/data structures which are secure against timing attack. I think GNU libstdc++ std::string::compare(), std::unordered_map ...