how to do internal subdomain enumerations in corp network? I need to figure out a good way to do internal subdomain enumerations in corp network? My goal is to find the list of internal subdomains in my organizations. I tried https://github.com/TheRook/subbrute but this is for external domains only.

What would be the best way to do this?

Internal DNS are widely configured to authorized zone transfert in the internal context.

you can use the tool fierce for example. It makes an initial AXFR request (zone transfert) or use dig @myinternaldns axfr mydomain.com

If these tools don't work, your company is not allowing internal zone transfert for security reasons and you should not try to pass over the internal security policy without asking them


I just received a phishing text message, how could this have worked? I received a phishing text message that pretended to be my bank. It had a link that went to a site that redirect to the following script:

When I did a wget on that page with the rest of the full url it ran the following script:

<META http-equiv="refresh" content="0;URL='https://www.banksite.com/'">

From a technical perspective, I'm trying to figure out what this phishing text could have done in the worst case scenario.

To investigate what a booby trapped web server might try to do on your system, you will have to pretend to be one of the leading targeted browser: Internet Explorer.

With wget and curl this attack reverse engineering can be conducted with the use of the argument --user-agent. Here is a typical example:

wget --user-agent "Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko"

Here is one of the easy reference web where you could get other valid user-agent to test in this attack reverse engineering:

User agent string

As a basic protection rule, I advise you to run these tests in a dedicated user environment which won't risk anything at your system level and at your network level. For this create an ad hoc new user which isn't priviledged and which isn't known on any of your directory servers (LDAP or AD) so as to avoid any lateral attack by creating a large access user on other systems.


How secure is using public computer? I got questioned about the security of using public computers and sending data with them. I am using HTTPS which is based on SSL, while SSL uses PKI which is hard to hack. Thus, there is nothing to worry about while using a public computer. Is it right? (I don't take into account cases with computer-based viruses like Trojan)

Not Secure At All
HTTPS mitigates against several threats, such as:

An attacker impersonating the server you try to communicate with
An attacker reading your communication between you and the server
An attacker modifying your communication between you and the server

However, these are all network-based attacks. On a public computer, the attacker has many ways of compromising you, (and even compromise guarantees made by HTTPS). For example, an attacker could

Install a Keylogger and wait for you to log into an account of yours
Install a custom Certificate Authority, allowing them to impersonate any server (e.g. Facebook, Google, etc.)
Install a screen recording software to spy on your private data while you view it

There are many other ways how an attacker can gain access to your data, should you choose to enter or read sensitive data on a compromised machine.


What is the purpose of these hacking attempts on my Plesk VPS via postfix? In my /usr/local/psa/var/log/maillog on my Plesk VPS I get the same set of log messages around every three minutes. I've reproduced an example of them below (my vps name has been changed).

Apr  3 18:11:26 myvps postfix/smtpd[12561]: warning: hostname vps863.hidehost.net does not resolve to address 91.200.12.150: Name or service not known
Apr  3 18:11:26 myvps postfix/smtpd[12561]: connect from unknown[91.200.12.150]
Apr  3 18:11:26 myvps plesk_saslauthd[12563]: listen=6, status=5, dbpath='/plesk/passwd.db', keypath='/plesk/passwd_db_key', chroot=1, unprivileged=1
Apr  3 18:11:26 myvps plesk_saslauthd[12563]: privileges set to (103:113) (effective 103:113)
Apr  3 18:11:26 myvps plesk_saslauthd[12563]: failed mail authenticatication attempt for user 'auditor' (password len=9)
Apr  3 18:11:26 myvps postfix/smtpd[12561]: warning: unknown[91.200.12.150]: SASL LOGIN authentication failed: authentication failure
Apr  3 18:11:26 myvps postfix/smtpd[12561]: lost connection after AUTH from unknown[91.200.12.150]
Apr  3 18:11:26 myvps postfix/smtpd[12561]: disconnect from unknown[91.200.12.150]
Apr  3 18:11:56 myvps plesk_saslauthd[12563]: select timeout, exiting

What are they trying to do here? And does this indicate there's something wrong with my security configuration or is just normal evidence of hacking attempts?

To quickly run through the log lines, anything with postfix/ in it relates to your SMTP server (the server responsible for sending/receiving email, where e.g. IMAP presents email to users).

The other lines, relating to plesk_saslauthd, are from your authentication backend for postfix.

So:

Apr  3 18:11:26 myvps postfix/smtpd[12561]: warning: hostname vps863.hidehost.net does not resolve to address 91.200.12.150: Name or service not known
Apr  3 18:11:26 myvps postfix/smtpd[12561]: connect from unknown[91.200.12.150]

A connection to postfix (presumably on tcp/25) was made by a server at 91.200.12.150 (which doesn't have a proper A/PTR pair, and claims to be part of hidehost.net)

Apr  3 18:11:26 myvps plesk_saslauthd[12563]: listen=6, status=5, dbpath='/plesk/passwd.db', keypath='/plesk/passwd_db_key', chroot=1, unprivileged=1
Apr  3 18:11:26 myvps plesk_saslauthd[12563]: privileges set to (103:113) (effective 103:113)
Apr  3 18:11:26 myvps plesk_saslauthd[12563]: failed mail authenticatication attempt for user 'auditor' (password len=9)

That connection attempt was followed by an attempt to login as user auditor, and after plesk_saslauthd spawned a process to deal with it, that attempt failed.

Apr  3 18:11:26 myvps postfix/smtpd[12561]: warning: unknown[91.200.12.150]: SASL LOGIN authentication failed: authentication failure
Apr  3 18:11:26 myvps postfix/smtpd[12561]: lost connection after AUTH from unknown[91.200.12.150]
Apr  3 18:11:26 myvps postfix/smtpd[12561]: disconnect from unknown[91.200.12.150]

Postfix is told this user failed to authenticate, reports as much to the 'client', and the client disconnects.

Apr  3 18:11:56 myvps plesk_saslauthd[12563]: select timeout, exiting

The process used to check the credentials supplied during the connection exits.

The main things you should be concerned about are:

not allowing any important accounts to be bruteforced by repeated, unlimited attempts
ensuring insofar as possible users choose good passwords.

As for your other concerns, there isn't enough log to say if your service can be abused.

As @dandavis mentions, this happens all the time, so making sure you have followed any applicable best practices (OS, Plesk, and individual services) is probably a good thing.


Why does ACME / Let's Encrypt require A records not CNAME? I'm using ngrok to demonstrate the ACME protocol on IIS/Windows. However, this service prefers CNAMEs over A records.

In debugging the interaction it seems that ACME only allows for A records.  What is the security rationale for this behavior?  What alternative is there?

Error message here:

    {
      "type": "http-01",
      "status": "invalid",
      "error": {
        "type": "urn:acme:error:connection",
        "detail": "DNS problem: SERVFAIL looking up A for dev.server.com",
        "status": 400
      },

The answer by sebastian nielsen is wrong insofar that the security hole was in an unrelated service called startencrypt. The implication that Letsencrypt doesn't support CNAME records is also incorrect as verified by this thread and several others where Letsencrypt moderators assure people that they do support CNAME records. In fact I have just passed verification for a subdomain that I have pointed at an Azure VM by using a CNAME record.

The error message certbot gives, when something is wrong is pretty misleading though and I could not find anything in the official docs about CNAME support, leading to all this confusion.


Dangers of Sending Onetime Pin numbers over http Are there any dangers of sending a one time pin number from customer to my server over HTTP?

Somebody is arguing that its okay since it will only be used once. So there's no chance of an attacker reusing it after it has been used.

Yes, it is problematic.

An attacker may intercept the connection, return a "Login failed, please try again" to the client, and proceed to use the one time pin himself. If the transaction is low value, this may not be a problem, but it's trivial to avoid: use TLS.

In general, there's no real reasons not to use TLS today. Certificates are free, setup is easy, and browsers will soon mark form submissions over HTTP as insecure:

So whilst it may be tolerable in some applications, the question is why you would want that, when it is so cheap to reduce it to nearly zero?


Source Code analysis tools available? In the near future I have to check the source code of a web application on security vulnerabilities. The web application mainly consists of PHP files and contains more than 300 files.
Do you know programs that can help me with the security analysis of the source code?

For PHP, you can consider tools such as SecureAssist (by Synopsys). Its decently comprehensive and helps find security related vulnerabilities.

Other options include tools such as RIPS.

More  information can be found on the Owasp static analysis tools page:

https://www.owasp.org/index.php/Source_Code_Analysis_Tools


Is it secure to use TOR with AVAST antivirus? Today when I opened an incognito session in Chrome Browser, I got an immediate pop-up from Avast antivirus:

Should I be concerned that my antivirus is acting like spyware? I sometimes use  the TOR Browser Bundle (Firefox), can avast monitor that too?

Anti-virus programs are a little like spyware

AV needs to have visibility into every process being run on your computer. Even spyware doesn't dig as far into your machine as AV does.

The question is about what you mean and what you expect when you say "can AV monitor my browsers?" Avast saw that you were running an incognito session because it could see the process being launched. It's like noticing that you launched Chrome at all, which is the most basic function of AV. That does not mean that it is inspecting all the data you send through the browser.

HOWEVER: Some AV products do have browser plugins that can inspect the data in the browser. You have to turn this function on, though.

So, just because Avast saw that you launched an incognito window does not mean that it can read what you send through it.


How to estimate the cost of an application vulnerability? I've seen data on the cost of a breach including lot of surveys and research by Verizon and the Ponemon Institute. But in terms of an actual vulnerability, what are the factors to consider to determine the cost?

Few things I had in mind are:

Risk factor: SQL Injection vs Reflected XSS
Cost to detect manually or by automated scanners
Cost to fix in terms of developer hours
Costs associated with vulnerability leading to failing a compliance audit

How do you security and risk management professionals determine the cost of a vulnerability?

The cost is not from the vulnerability but from the risk. Namely:

A vulnerability is that which can potentially be exploited to put at risk your information assets (e.g. a buffer overflow).
A threat is a context element which will try to snoop on or damage your information assets (e.g. an existing group of attackers who would benefit from such actions in some way).
A risk is when a threat meets a vulnerability, and they get along well, and marry, and have offspring.

The cost is something applied to whatever you do with the risk. For instance, the cost of ignoring the risk is, roughly, the cost of the damage resulting from the actualization of the risk. On the other hand, the cost of fixing a buffer overflow is purely development & deployment cost, since it removes the vulnerability. The art of risk management is to strike the right balance between corrective actions and acceptance (the "right balance" being relative to the risk management goals, which depend on the organization).

Bottom-line: cost is about what you do, and depends on a lot of contextual elements, in particular threats. You cannot estimate any meaningful notion of cost without taking the context into account. You cannot attach a cost to a vulnerability, or even to a risk; the cost is a property of a set of actions (since "doing nothing" is such a set, some cost is always incurred).


Which Extensible Provisioning Protocol (EPP) status-values provide sufficient protection against domain hijacking? The Extensible Provisioning Protocol (EPP) as described in RFC 5730, can possibly be protective against domain hijacked. The protocol consists of the 17 following status-values as described in RFC 5731:

clientDeleteProhibited, serverDeleteProhibited, clientHold, serverHold, clientRenewProhibited, serverRenewProhibited, clientTransferProhibited, serverTransferProhibited, clientUpdateProhibited, serverUpdateProhibited, inactive, ok, pendingCreate, pendingDelete, pendingRenew, pendingTransfer and pendingUpdate.

The definition of the EPP status-value ok is:

  ... the normal status-value for an object that has no pending operations or prohibitions.

Therefore, a domain with the EPP status-value ok should be considered potentially vulnerable to domain hijacking because it has no EPP prohibitions. Is a domain with one ...Prohibited EPP status-value sufficiently protected against (a form of) domain hijacking or should multiple ...Prohibited EPP status-values be used for complete protection against domain hijacking?

In other words, is the protection that EPP can offer insufficient when only one (instead of multiple) ...Prohibited EPP status-value(s) is/are used?

Generally speaking, the EPP codes will not help prevent domain theft/hijacking, at least in generic top-level extensions.

Before 2006, it was possible to steal .com/.net (possibly other extensions) as long as a) they were not locked and b) the rightful domain owner would not object to it. b) in particular could happen when the registrant E-mail was out of date, had lapsed or the notification mail is spam-trapped.

With the introduction of the EPP code the practice of stealing/hijacking domain names has become more difficult.

The following applies to generic top-level extensions (ccTLDs often have different rules):

In order to transfer a domain name to another registrar, you need the so-called EPP code, and the registrar-lock status must be lifted. Which translates to lifting the clientTransferProhibited status.

The EPP code is often sent to the registrant E-mail address but can sometimes be retrieved online. It depends on the registrar. The registrar is also where you lift the transfer lock.

Valuable domain names are stolen sometimes. It often involves taking over the administrative E-mail account. If a hacker can take control of your E-mail address he can a) reset your password at the registrar (security questions may apply depending on the registrar), b) take over the registrar account, c) unlock the domain and retrieve the EPP code, d) transfer the domain away - or just mess with the DNS settings, for example to perform a malicious redirect.

The EPP status is a moot point actually. Just because a domain doesn't have any flag set, doesn't mean you can mess with it. If you can hack into the registrar account on the other hand, it's almost certainly game over.

To sum up, the best way to protect your domain names, is to make sure the administrative E-mail is secure and up to date and choose the registrar carefully.
Some registrars have enhanced security features like like 2FA, automatic E-mail notifications, while others may still be storing passwords in plain text and should be avoided just for that reason.

It goes without saying that the user account at the registrar should be protected with a password that is unique and hard to guess, and it doesn't hurt if the username is not too predictable as well.

One final note: the administrative E-mail is displayed in the whois record, as such it is public information. It is therefore a good idea to use an E-mail address for your registrar account, that is different than the one listed in the whois record.

Reference:
ICANN: EPP Status Codes | What Do They Mean, and Why Should I Know?


Why delete user accounts, when no longer needed - business I was reading that for business's it is essential that they remove the user's account as soon as that person leaves the company. So, my question is why?

I understand the need to remove accounts which can accessed remotely, as the person who left the job could be disgruntled and leak the data to a competitor etc but I can't see the point of removing a user account on a computer immediately.

I know this question sounds really simple but I can't think of a specific reason why.

Any help would be greatly appreciated, thanks.

From my experience, there are 3 key concerns when an employee leaves an organisation:

The risk of remoting in (As you said)
Other employees (eg: admins) could abuse use the ex employees credentials knowing they would be difficult to track. Alternatively, disgruntled ex-employees could give their creds to an internal staff member and collude to leak out info.
Data that the ex-employee leaves behind needs to be archived in case the organisation needs it (eg: important files/emails, etc). But this needs to be done securely as there could be personal/private employee info that is left behind which should not be accessible by other staff

These 3 reasons are the main reasons I find why employee accounts need to be deleted immediately on exit. It is also common practice for organisations to leave accounts around for while for "Housekeeping" purposes, but this practice again is very questionable.

Hope this helps

R


ip xfrm limit in iproute2 for ipsec I am using ip xfrm state and ip xfrm policy commands from iproute2 tool to implement IPSec. I have read documentation of iproute2 (PDF) and ip-xfrm man page.  The man page states:

  LIMIT-LIST := [ LIMIT-LIST ] limit LIMIT

  LIMIT := { time-soft | time-hard | time-use-soft | time-use-hard }
         SECONDS |
         { byte-soft | byte-hard } SIZE |
         { packet-soft | packet-hard } COUNT

  LIMIT-LIST
                sets limits in seconds, bytes, or numbers of packets.

Unfortunately, I couldn't find any documentation which explains the difference between time-soft vs time-hard and time-use-soft vs time-use-hard. Can anyone please explain these LIMIT types or any documentation reference ?

The soft limits can be used to implement rekeying. If either limit is reached the kernel will send expire messages to anyone listening for events on XFRM or PF_KEY sockets. But if a hard limit is reached the kernel also removes the state/policy automatically.

A keying daemon that installs SAs will usually set the limits so that there is enough time between the soft and hard limit to rekey the SA and it will use the expire event for the soft limit as trigger the rekeying. This mechanism is defined in RFC 4301 (Security Architecture for the Internet Protocol).

While a keying daemon could implement its own timer to trigger rekeying after a certain time, this isn't possible for packet/byte limits without relatively expensive polling of the usage counters of each SA.


How secure is Samy Kamkar's Anti-MITMA Diffie-Hellman Key Exchange Technique? I'm currently using Diffie-Hellman to encrypt data sent across an arbitrary link (can be ethernet, Wi-Fi, USB, bluetooth, etc), and I'm not a huge fan of the potential that DH is vulnerable to an active MITMA.

I came across Samy Kamkar's Anti-MITMA technique. Does anyone have any thought on how secure this is?

From my understanding, the above technique involves taking a password and using the shared secret as the salt, hashing them together, and sending the hash to the end host. If the end host does not know the password, then it can't reverse the hash, assuming it's prohibitively expensive to hash with the given function, and thus expensive to brute force in a short enough amount of time.

Or at least, I'd imagine that the generated hash can be used as the shared secret, thus saving us the effort of having to send the hash.

From a quick look, this is reasonably secure against a network attacker. However, it requires the server to store the password as plaintext, which is discouraged. Secure password storage has been discussed at length on this site.

A somewhat similar protocol is SRP which achieves the same goals as Samy Kamkar without storing a plaintext password on the server. As a side benefit, it is actually slightly faster as one fewer round-trip is required to login.

As a more general point, the SRP protocol has been subject to detailed analysis and is thought to be secure. Samy's protocol has not (as far as I can tell) be subjected to the same rigour so there may be subtle issues. You should use SRP so you don't roll your own crypto.

Update - Another consideration is that Samy's protocol reveals a password hash to an active MITM attacker, which they could then brute force. This is quite a bad weakness, which SRP is not vulnerable to.


My bank support just asked me for my online banking credentials As title says, I was asked for my online banking password while on the process of getting in touch with a real person. This is something I'd never do and knowing that the call was being recorded (for further improvement of the bot I was talking to) makes it even worse.

For sure, after that, I hung up and I'm pretty sure it is a violation of privacy as you are asked for private details and also it is not encrypted whatsoever.

Have anyone been asked for this before?
Is this a normal practice?
After saying my ID number, the bot refered to me as "Mr. my_last_name" so I guess it is a legit phone number but, could they been hacked and the support number hijacked?
Should I take any actions?

Assuming that you called them on a published number, I'd say that this sounds like it was an interactive Voice Response (IVR) system, which is pretty common in the banking world.

The concept is that the system takes your authentication information before passing you on to a contact centre agent.  The benefit of this from a security perspective is that then the agent in the call centre doesn't have to ask you to authenticate yourself, before discussing your account.

If correctly implemented this should be no more insecure than typing your password into a website.  There is an automated system processing the voice data and it should store/log this appropriately.

Of course as you point out there is the risk of phone tapping, but then if you assume that your phone line is tapped, any form of phone banking is insecure as they've got to authenticate you somehow to be able to discuss your account with you.

EDIT: To add some more details, rather than leave them scattered around comments that could get cleared.

Basically banks have to authenticate you somehow, no matter which channel (e.g. web, phone, branch) you use to contact them, and there are trade-offs to be considered.

On the one hand having dedicated credentials per channel is useful in that it reduce the risk of compromise, and avoids muddying the message of "don't tell people your web password" but it leaves users with more credentials to manage and in all likelihood a lot of password resets if users only use a specific channel rarely (with all the vulnerabilities that frequent resets attract)

So the option that it appears, from the information provided, that's used here is to combine the credentials for the web and phone channels, and to use an automated IVR system on the phone channel to avoid credentials being given to contact centre agents.  The upside here is single set of creds, so user's won't forget them, and the downside is the scenario we see where bank messaging "don't give people your password" leads to problems in using this system.

In terms of the IVR system security, this is essentially like any other system that processes data. It needs to be secured appropriately so that user credentials are not exposed, no different than the web channel.

Obviously a system like hardware (not SMS) 2FA could work well in this scenario as numeric codes are easily passed to IVR systems, but that has it's own tradeoffs in terms of cost and user experience.


Tacacs+ scenario: can I permit user to configure only for one interface and deny others I'm currently deploying TACACS+ with a Cisco device, I use a TACACS server from here: http://www.shrubbery.net/tac_plus/

My scenario is: I want to permit a user to configure my router but only for a specific interface, i.e to gigabitethernet0/0. After arriving at the router(config-if)# that user can do whatever he wants with that interface, but he cannot change to another interface nor change the configuration in the router(config)#  .
So far my configuration in tac_plus.conf is like this:

#limited admin group = limitedadmin {
default service = deny
service = shell {
priv-lvl = 15
}
cmd = configure {
permit terminal
}
cmd = interface {
permit "GigabitEthernet 0/0"
}}

And this is the Cisco config:

aaa new-model
aaa authentication login default group tacacs+ local
aaa authentication login telnet group tacacs+ local
aaa authentication login lokal local enable
aaa authorization config-commands
aaa authorization exec default group tacacs+ local
aaa authorization exec telnet group tacacs+
aaa authorization commands 1 default group tacacs+ local
aaa authorization commands 15 default group tacacs+ local
aaa accounting commands 1 default start-stop group tacacs+
aaa accounting commands 15 default start-stop group tacacs+

But with this, I cannot specifically permit that user at config-if without allowing him to configure at router(config) too.

Is my scenario possible using TACACS+  ?

I'm sure there is relam for this but what can I remember from my days as new guy that priveleges are based upon command sensitvity not port wise. What command is executed is where you define control.
 It make sense as where user x an configure interface IP or speed and do the same for 100 interfaces it's the same trust level.

As for config-if  works in inheritence fashion it automatically inherets all priveleges for config level.

 default service = deny
 cmd = interface { permit [faFAgiGI].* }

This would make users to have access to issue "interface Gi."
or "interface Fa.". I do not want them to have the ability to issue "interface Te.*".


Print or burn encryption key? I'm thinking of setting up a cloud backup for home computers, and to increase privacy I want to encrypt the data with my own encryption key.

The "cloud" would give me a chance to restore data in case of catastrophic event causing loss of all hardware (say - flat burned down) but I still have to store the key offsite to be able to do that.

I was thinking of either burning a DVD with the key or printing it in a big font (for OCR or manual entry) and I wonder what would be the best in terms of chance for successfully restoring the key after a few years in storage?

I still can use CDs I've burned down over 10 years ago. There are papers from thousands of years ago as well, so it's really a matter about how good are the conditions where the CD or the paper are stored.

Anyway, why limit yourself to just either of them? Use both.


How google track phone data for traffic I heard that google map's traffic details are populated using mobile user's gps data. Is this a true statement ?

If it is true , can google track our data without our consent ?
If all mobile phones's gps data is off, How can google track these phones ?

Yes that statement is true, google maps traffic data are crowdsourced. Your phone send data to google about your location and your speed. And then they compare it with the data from the other devices. You can read more about this in their official blog here.

Even if you turn off your gps they can track you. Most of the modern phones can use data from cellular towers and they can pin-point your location. This is called a-gps if I remember correctly and they can say where are you using a method called trilateration.

If you have privacy concerns, then I suggest you check google maps settings somewhere there is an option called "Location Reporting" you can disable it.

If you are truly paranoid then, congratulations! You will have to change:

your life style
possible country (because of laws)
your phone operating system (or even the whole thing because who knows what is inside in these blobs, if you want an alternative see this).

PS:
Remember "If You're Not Paying, You're The Product"
in some cases might not be correct, but these cases are not that many.


Feasibility of creating an in-memory web app (that runs from a CD-rom on a web server) for sharing self-destructing messages This question is about a hypothetical in-memory web application that is used for exchanging encrypted messages that passively self-destruct in X amount of minutes.

Here the messages would be stored at the web app, and the intended recipient would receive a link through which they could access the message before it is erased from the server RAM.

The thought is that this web application would run from some read-only media (e.g. CD-ROM) and for that reason could not be altered.

We have in-memory databases but (AFAIK) no in-memory web applications. Would something like this be technologically (or otherwise) feasible?

Technically feasible?  Certainly.  It doesn't sound different from any other live CD, just with a server-oriented environment rather than the more traditional desktop-oriented one.

What advantages do you picture this having, though?


Why MA-SSL has been introduced? If my knowledge is correct with respect to simple SSL, Mutually Authenticated-SSL has the advantage that both end parts are authenticated one to another:

  Not only the Client endpoint knows that he is communicating with the
  Authenticated Server endpoint, but also the Server endpoint is sure
  that he is communicating data with Authenticated Client endpoint and
  not with a third party unauthorized (MITM).

My question is:

"In what kind of scenario will this grant a higher level of security in communication?"

In other terms:

"What kind of attack that a MITM can pursue in a communication based on simple SSL is completely avoided with MA-SSL?"

Reason 1 One kind of attack a mutually authenticated SSL connection would protect against is credential stealing XSS.

Typical SSL encrypted connections only authenticate the server. To authenticate the client, the user enters her username/password. Typically then, the user's session id is used to maintain that authenticated connection with the server.

An XSS attack could steal that session id and send it to the attacker. The attacker then uses that session id to gain access to the user's account without needing a password.

MA-SSL would protect against this as the client is authenticated (probably with a client certificate) and no session id is required.

Reason 2 Another reason for MA-SSL is that with the traditional deployment of SSL (server auth by cert, client auth by password), if a server can trick the client into believing the authenticity of the server (e.g., misspelling the domain by a single character and registering a valid certificate), when the client is authenticated, the server now has the ability to impersonate the client. MA protocols based on certificates are much easier to design in such a way that the server cannot impersonate the client after a successful authentication of the client.

NOTE: The use of MITM in the quote you posted seems wrong.


Protection of eduroam credentials Recently my educational institution officially switched over from the their own wireless network to eduroam.

If I understand correctly from the FAQ, credential authentication is performed on the servers at my educational institution no matter where I log in from:

  When a user tries to log on to the wireless network of a visited eduroam-enabled institution, the user's authentication request is sent to the user's home institution. This is done via a hierarchical system of RADIUS servers. The user's home institution verifies the user's credentials and sends to the visited institution (via the RADIUS servers) the result of such a verification.

In addition, it states that:

  In eduroam, communication between the access point and the user's home institution is based on IEEE 802.1X standard; 802.1X encompasses the use of EAP, the Extensible Authentication Protocol, which allows for different authentication methods. Depending on the type of EAP method used, either a secure tunnel will be established from the user’s computer to his home institution through which the actual authentication information (username/password etc.) will be carried (EAP-TTLS or PEAP), or mutual authentication by public X.509 certificates, which is not vulnerable to eavesdropping, will be used (EAP-TLS).

Some questions that I have are:

How is eduroam different from a VPN in terms of security?
Is it any less secure to connect to eduroam somewhere other than my home institution?
How do I know that my credentials are encrypted between my device, the access point I'm connected to, and the authentication servers?
Is there a centralized database of domains and authentication servers (i.e. how does it know which server to check for user@uottawa.ca and user@ucalgary.ca)?

How is eduroam different from a VPN in terms of security?

Eduroam is only an infrastructure for authentication, it allows your institution's servers to prove that you're indeed the person that you claim to be. It only authenticates you, but doesn't tunnel your traffic or similar - your traffic is still at the mercy of whatever network you're connecting to, so you have to trust that network and its administrators to not be malicious or only use secure protocols such as HTTPS.

  Is it any less secure to connect to eduroam somewhere other than my home institution?

Your Eduroam credentials are safe and only your home institution can see them. Your traffic is less safe and you have to trust the network and its administrators, though EAP uses a different key per user so someone else on the network wouldn't be able to eavesdrop on your traffic like they can with open or PSK-protected networks.

I'll leave the last two questions to someone else as I'm not 100% sure.


Data Abstraction Layers in Forensic Imaging I am a bit confused from various sources about the abstraction level and layers that a file resides in forensic imaging.
I have found two slightly different explanations:

The first one includes

a) Physical Layer (sectors,cylinders etc.)
b) Data Layer (Unallocated space etc.)
c) Metadata Layer (i-nodes, alternative data streams etc.)
e) File System Layer (superblock, boot sector etc.)
f) File Name Layer

The second one includes:

a) Physical Media Layer (sectors,cylinders etc.)
b) Media File Layer (partitions etc.)
c) System Layer (boot sector etc.)
d) Application Layer (ascii etc.)

I notice there are some similarities but I try to figure out if the 1st one is an extension of the second or else.
Can anyone clear this out?

When you take a forensic image, you can generally take either a physical or logical image of a drive. See this article for the differences.

When you create a physical forensic image, your imager is reading the values of a drive bit by bit for the entire drive (unallocated space and all) whereas if you are to taking a logical image, the imager queries the OS and retries only the 'active' bit values within the drive.


What is the precise difference between a signature based vs behavior based antivirus? I do not understand very well the difference  between signature based vs behavior based antiviruses. Please clarify the distinction between the two.

Signature-based AV compares hashes (signatures) of files on a system to a list of known malicious files. It also looks within files to find signatures of malicious code.

Behavior-based AV watches processes for telltale signs of malware, which it compares to a list of known malicious behaviors.

The reason many AV products are add behavior-based detection is because many malware creators have begun using polymorphic or encrypted code segments which are very difficult to create a signature for. An easier way to detect these is to watch for a particular pattern of behavior to identify the malware.


HMAC and using a cryptographically safe random field as message Say that I have a big application for which I would like to create a secure API. The standard way to go would be to work with a public API key and a secret API key and provide these to the user. Next, in every API request, the messages are signed using a MAC on the secret key and (some part of) the message.

Now, since this application is a big one, I don't want to have to select my message field on a per-API-gateway basis (e.g. if my API request was for answering a question, message=answer, if my API request was for posting a comment message=comment etc...).

For convenience I would hence like to add a cryptographically safe random field, which is added upon every request (let's call this field our salt). This way I can write one request verification that covers all situations.

My questions is now:

Is this a good idea and why (not) so?

A unique (often random) element added to a message is called a nonce. It can be used as a defense against replay attacks (that is, an attacker who can observe a correctly signed legitimate request could later replay that exact request to cause the server to take the same action again). As such, it can be very useful (assuming you verify that a given nonce can indeed be used only once).

However, if I understand you correctly, you want to compute the MAC for the nonce/salt instead of for the actual message data. This will not work, as only the parts of the message that are included in the MAC are protected, of course. I suggest you serialize your entire message into a suitable format (e.g. JSON), compute the MAC over it, and send both in the request. That way, the MAC/signature is not a part of the message proper, and verification can be done without knowledge of the message's structure itself.


AWS IAM policies that differentiate between console & access key access Question:
How can an AWS IAM policy be devised to differentiate between a console (web) and access key (API) access?

Use Case:
Say, I want to allow the a certain group of users full IAM privileges via console(web), and read only IAM via access key (API).

The specific use case is that I trust some AWS users with full IAM privileges, as they have 2fa for console access. They dont practice 2fa for access key access, and it is significantly easier to misuse. Yet they still need some (read) access key (API) access, as they employ auditing tools and often use CLI.

Progress:
The condition component in an AWS IAM policy looks promising, i've been able to use it effectively to enforce the use of IAM;

"Condition": {
                "BoolIfExists": {
                    "aws:MultiFactorAuthPresent": "false"
                }
            }

But I could not find any relevant conditions which AWS support to account for differentiating between console and access key access.

Apparently I can't.

AWS does not differentiate between access key and console password authentication. There are some temporary credentials and 2FA IAM policy conditions, but they do not fit our use case.

One can use some IAM conditions to fit my or similar use cases, but not the way I planned;

the UserAgent condition to differentiate between cli, browser and sdk users. BUT BE WARNED, it can EASILY be tampered with, this is NOT an airtight control.
the sourceVpc condition
(apply a global 2FA policy and exclude anything from your VPC, that way applications running with AWS IAM user access keys aren't disrupted. Yet I know they shouldn't be, but they are);

"Condition": {
         "StringNotEquals": {
           "aws:sourceVpc": "vpc-111bbb22"
         }
       }


Does LUKS protect the filesystem integrity? I have read in:

http://css.csail.mit.edu/6.858/2013/readings/bitlocker.pdf

that Bitlocker does not provide data integrity since it takes more space in the disk. The PDF says also that drive encryption systems do not offer integrity of the stored data, implementing the so-called poor man authentication:

"The best solution is to use poor-man’s authentication: encrypt the data and trust to the fact that changes in the ciphertext do not translate to semantically sensible changes to the plaintext. For example, an attacker can change the ciphertext of an executable, but if the new plaintext is effectively random we can hope that there is a far higher chance that the changes will crash the machine or application rather than doing something the attacker wants."

Does LUKS offer any integrity checks on users data?

As of Arch's wiki (https://wiki.archlinux.org/index.php/Dm-crypt/Specialties):

"mkinitcpio-chkcryptoboot is a mkinitcpio hook that performs integrity checks during early-userspace and advises the user not to enter his root partition password if the system appears to have been compromised. Security is achieved through an encrypted /boot partition, which is unlocked using GRUB's cryptodisk.mod module, and a root filesystem partition, which is encrypted with a password different from the former. This way, the initramfs and kernel are secured against offline tampering, and the root partition can remain secure even if the /boot partition password is entered on a compromised machine (provided that the chkcryptoboot hook detects the compromise, and is not itself compromised at run-time)."

Kind regards

LUKS formatted with --integrity <algorithm> option will provide integrity protection for the encrypted volume.

For that to work, --type luks2 must be used when formatting the device (opening of the device formatted with LUKS2 and integrity protection works exactly as for "normal" encrypted devices).

The downside is that the integrity target requires data to be written twice to preserve atomicity of the writes. It is possible to disable this feature (--integrity-no-journal) with the possible risk of data being lost – mismatches between checksums will be reported as I/O errors on reads. Second downside is that some space is lost to checksums, between 0.1% (for crc32) and 0.78% (for SHA-256).

With Advanced Format drives (4K sectors), it's good idea to also provide --sector-size 4096 as that will ensure block-alignment of virtual blocks to disk-physical blocks.

See FOSDEM presentation.


SSH Public Key Authentication vs Username/password for API Access I have a linux device that will be making periodic call to an API server, say everytime the system boots up. Everytime then it should authenticate itself and then do its thing.

I can either store the username/password in a .config file, or create a public id_rsa.pub SSH-key.

My question is this: Why is the SSH authorization considered better? I mean if somebody gets access to my linux machine, then they can read both username/password OR the SSH key and they can then copy these information to their own laptop.

Am I missing something here? Note These username/passwords are all generated by me and will all be random 256bit strings. So the typical reasoning of people will use weak and predicable passwords does not apply here.

Update

How about the following approach:

You have a seed number, which will be a md5 of something. This value is stored on the server and every machine.

Now, during authentication, a client will send two strings,

str1 = md5(timestamp + random());
str2 = md5(str1 + seed);

The server will receive these two numbers and will accordingly recalculate str2 from str1. If str2_from_server == str2, then a token is generated and sent back. This token will expire with one use or after a period of time.

The tokens will be saved in a table key/value pair of str1 str2 token and can never be reused again (realistically, this table will be cleared every once in a while so that it does not grow infinitely large).

Is this any superior/inferior to SSH?

There are several differences.

First, by setting up your API server to accept username/password (as opposed to only allowing access via keys, which is increasingly a best practice to do) you potentially decrease its security in general, as, now, users with weak passwords on the system (or, worse, services that you install which may have hardcoded default passwords) will make it possible to breach your server.  Brute-force attacks are suddenly an option for those wanting to break into your system (which, if you run an SSH server on a public IP you are guaranteed to see almost immediately). Disabling ssh login via passwords and requiring login keys is as simple as setting: "PasswordAuthentication no" in your sshd_config and restarting the sshd service (or your server). I do this on every linux box I build as one of the first steps.  Plus, this encourages setting up a very long and random password, since (if you set up /etc/sudeoers properly) you will never actually use it for anything. :)

Second, with the ssh key option, you can easily set up the authorized_keys file in such a way that it will:

Only allow access from a specific IP; and
Only allow the accessing user/script to execute a certain command.

This way, even if someone compromises your client box, the stolen key can't be used to log into your server from anywhere else in the world, and, if you set it up properly, it can't even be used to login from your client for anything other than what you allowed. For example, I use this to set up accounts/keys that can do nothing except rsync with certain options from a certain folder. So, even if the key were stolen, the attacker gains nothing other than being able to execute the command that the client machine is executing itself anyway, and only from the client's IP, nowhere else. I.e., gaining the key has not allowed the attacker to compromise the API server. You might be able to restrict an account that's password-based to only execute a certain command or only login from a certain IP, but I've never seen this done and don't know how easy it is.

Third, when you want to give access to your API server to another person/system in the future, and you want to use passwords, you run into the key distribution problem (ironically enough). I.e., you have to have a secure channel to exchange the initial account password so that the user can log in.  With SSH keys, all they have to do is email you their public key (which isn't something needing security), and (as long as you trust the email is from them, which there are ways to ensure), and you can give them access.

So, I hope this has convinced you that there is value to using keys (and, really, you should not be using password-only access on anything; keys or 2FA for public services are the only way to go :-)).  Cheers.


Detecting PRNG Use from Output Question: Is there a way to detect the use of a PRNG strictly from observing the output provided by an application?

Background: During an audit of a key generating algorithm that I knew was based on the LCG I noticed that Burp's sequencer rated the entropy of the keys as strong, which is false as they are predictable.
I then fed the same test with raw integers generated by Python's Mersenne Twister based random module to see entropy rated as high again.

The failure of this tool got me to wonder wether there are tools/approaches available for actually detecting PRNG use from output.

If the PRNG is cryptographically strong, then, by definition, its output cannot be distinguished from random bytes. That's the thought experiment by which a PRNG is supposed to be tested: two black boxes are given to the attacker, one implementing the PRNG, the other producing really random bytes (that one contains a gnome who throws dice real quick). The attacker goals is to find which box contains the PRNG, with a better success rate than pure luck (i.e. 50%).

PRNG which are NOT cryptographically strong, such as Mersenne Twister, can be recognized as such by an attacker targeting them specifically. But not necessarily by a generic statistical analysis tool.

To take an analogy, there are PRNG which are strong against armies of cryptographers who know the complete source code of the PRNG, and have access to a thousand big computers. There also are PRNG which can be declared non-random by a woodchuck wielding an abacus. And there are PRNG which are in between: generic simple tools won't catch them, but it does not mean that they can't be caught, only that it takes some more effort.

(Mathematically, it is not known whether cryptographically strong PRNG can really exist -- this is all the difference between an algorithm that cannot be broken, and an algorithm that we do not know how to break. A corollary is that we do not know whether there can exist an implementable analysis tool which would reliably recognize all non-strong PRNG. Right now, we have PRNG which are cryptographically weak, but statistically very good, so that analysis tools such as Burp's sequencer will find nothing non-random in them.)


When hardening a LINUX system what command line tools would you remove first in order to make an attackers life really difficult? When hardening a LINUX system what command line tools would you remove first in order to make an attackers life really difficult?

Most of the native tools are necessary for system administration. There are very few that you could remove without being concerned that you'll need them one day.

You run a serious risk of extending outages or delaying projects when administrators are missing essential tools.

Instead, you should focus on:

Making it difficult for an attacker to communicate with the system (network boundaries, packet inspection, removal of unnecessary services)
Isolating hosts based on sensitivity of data (DMZs, network ACLs)
Blocking inappropriate communication (HIPS, network IDS/IPS, local firewall/iptables)
Preventing exploitation and limiting escalation (patching, app-specific hardening, least privilege users, chmod jails, sandboxing)


ROP on MIPS Doesn't Land Where Calculated I am working on exploiting an application on MIPS to further my knowledge of ROP chaining. The library I am trying to build a ROP chain is libuClibc-0.9.30.3.so. I found a gadget that I want to use using Ropper. The offset is marked to be, 0x0002a730 and the instructions that Ropper show are lw $v1, 0x1c($sp); lw $ra, 0x24($sp); nop; jr $ra; addiu $sp, $sp, 0x28; the way I understand it is, I add this offset address to the base address of libuClibc-0.9.30.3.so to get the actual instruction address. I ran cat /proc/<pid>/maps to find the base address of libuClibc-0.9.30.3.so as 0x2aab1000 I also ran the program numerous times listing show proc mappings in gdband found that this address doesn't appear to change between executions of the application. So I am assuming that this application doesn't utilize ASLR I also believe this to be true due to the fact that file doesn't say the program was compiled with PIE enabled. Additionally, jumping to the location at 0x2aab1000 + 0x0002a730 is consistently the same, which all points to this conclusion. However, the instruction that gets executed is not the instruction I am intending to have executed when the code jumps to the location. Any pointers for things to double check or potential issues with my logic are much appreciated.

Well, after talking to numerous people and playing around with Ghidra and a few top gadget finders. This appears to be a common occurrence and isn't actually surprising. I was able to find the gadget I was looking for through trial and error and calculating where the offset sent me relative to where I wanted to be.


Can a program change the shortcut location of a browser to itself without UAC (Admin) in Windows? I was reading an article on .desktop files used to spread malware on Gnome and KDE. I just thought that the same could be applied to Windows.

On Windows:

Malware is disguised as a picture by changing icon. >> Funny pic
User opens it.
Copies itself to a place without UAC (Admin) like My Documents.
Replaces a shortcut like Firefox with its own location and retains the Icon.
The user opens it. Asks for UAC. Even says unsigned.
Windows user ignores the Unsigned warning gives it UAC.
Malware opens Firefox. The user doesn't realise a thing.
The computer is infected.

Would this work? Is UAC required for changing a shortcut of a protected location?

Edit: The whole point of this is to gain UAC without asking for it when it opens but trick the user into giving it UAC impersonating firefox or some other program.

The scenario you have described could possibly work. May not happen in the exact way that you depicted. .desktop files can sit in any location of the victim computer .

NOTE: It needs UAC to get inside a protected location.

Anyway it needs to be executed to starts its actual work. In case of windows just a double click (an execute command in case of Linux).

It can possibly impersonate/imitate any of the program that you recently used or a familiar software in your system.

When the user tries executing/clicking the impersonated file, it asks for UAC as you said. (This is highly detectable by this particular character). If given access then yes you are a successful victim and your computer is compromised.

However removing the .desktop files are not that difficult. Here's a good read about the .desktop files.


Can we use reverse image search to bypass image CAPTCHAs? Has there been any group that managed to bypass the Image CAPTCHAs using reverse image search? Whats stopping people from writing a script that bypasses these CAPTCHAs by reverse image searching via many services like Google and make a choice?

And also can this be done? I can imagine writing a python script that cuts one of the nine images in the captcha and then reverse searches it using a website, but the real challenge is how to make sense of the results and come to conclusion that whether this is for example a store front or not? Any ideas?

has there been any open source project demonstrating this? i want to write a python script that demonstrates this for a college project but its really hard, specially deciding based on the results that whether a picture is correct or not, since some results might be really complex. for example when they say locate pictures with sidewalks in them and the picture has many other stuff in it, it gets really hard to make sense of the results.

Yes, it can be bypassed and it was by quite a lot of groups/people. There are several payed services that offer exactly that. Their methods are advanced enough to recognize the images and solve it successfully, even better than most humans when it comes to text and with above 50% success rate when it comes to pictures, which is more than sufficient to bypass it.

To understand some of the ways this is possible, read the paper I’m not a human: Breaking the Google reCAPTCHA


Why does an external pentester testing my Azure website ask for IP, Gateway, DNS and VPN credentials? I have an Azure website and a client who wants to use my site but needs to perform ethical hacking on it in order to decide if it's secure enough for them.
They've asked me this to send them this:

  The network configuration to have visibility and connection or traffic
  to the target IP, i.e., IP/mask/Gateway/DNS. If the web server is
  accessed via VPN, the client and connection credentials

I thought the IP is enough (and they don't need me for it as they can look it up) - what am I missing? I don't want to give them sensitive data.

If the server is publicly accessible then you don't need to worry about VPN connection info. Security assessments are often performed on sites before they are exposed to the internet and the site is only accessible on a private network so they will ask for you to provide these details if that is the case.

The DNS name that the application will have will also be useful to the consultants who are testing the application. For example if they have a site at www.example.com and you are developing a replacement that is currently hosted at beta.anotherexample.com or just has an IP address, they may need to configure their hosts file for the site to work properly - this is quite common if you have developed a site in a CMS like wordpress and it expects all links to start with www.example.com even though the DNS name does not point to your server yet / the website hasnt been deployed to production

Probably the best thing to do is to ask for the mobile phone number of the tester that will test your site and chat with them about what they need. It will be useful to have this number (and for the tester to have your's) in-case the tester accidentally takes your site down or you need them to pause testing for some reason. They may also be friendly and be allowed to give you an informal 'heads up' of what the report is about to contain :)


Quantum Computer Advantage in SSH Login I understand that quantum computers are many orders of magnitude faster than today's binary computer and that this is expected to enable decryption that was unlikely (it would take too long) with today's binary computers.

That being said, how would the Quantum-computer speed-advantage render the username/password security of a home-router's SSH port ineffective?

Quantum computer misconceptions

First, I think you misunderstand quantum computers. They are a hard and non-intiutive concept, so I don't blame you. Let me try to clear things up.

Metaphor: GPUs are exceptionally good at computations involving matrices (aka linear algebra) and therefore excel at problems that parallelize well. At any other type of problem (computing pi, for example) they are much slower than CPUs.

Quantum computers are exceptionally good at computations involving waves, and therefore excel at problems with repetitive or periodic structures. There is a surprisingly small number of things that quantum computers are good at, but it just so happens that all the public key algorithms we use today (RSA, DSA, DH, and ECC) are in this category. Generally speaking, hashes and symmetric ciphers like AES are not vulnerable to QC's.

The statement that "quantum computers are faster than binary computers" is, except for a select type of problems, wrong.

Offline Brute-force

Here the attacker has a copy of the of the hashed password(s) and is trying to guess the plaintext password(s) (aka hash pre-images). Quantum computers are not very good at breaking hashes; but if you load the hash value into the qubit register, you can use Grover's algorithm to get a sqrt(n) speedup, essentially reducing a 128-bit hash to 64 bits, a 256-bit hash to 128 bits, etc. Assuming passwords are hashed with a 256-bit hash function, you're good. So if your users chose strong passwords (aka randomly generated), then guessing is still centuries or millennia, even with a quantum computer. Assuming your users chose weak easy to guess passwords, then QC's also don't make a difference because you'll crack it in under a minute on a regular GPU rig. So quantum computers don't really make a difference for offline brute-force attacks.

Online brute-force

Here you are submitting guesses to a live login server. Since the attacker doesn't know the password hash to feed into a quantum computer, you have nothing to run Grover's on. Besides, the 5 guess-per-secand rate-limit and IP banning done by the server is the bottleneck here, not the size of your processor. So quantum computers make no difference for online brute-force attacks either.

Key-Based SSH

You specifically asked about username/password, but I'll borrow from @Trickycm's answer. If your SSH server is using RSA keys rather than passwords, then it's a different story and against a quantum adversary you get something like "weak passwords" < "RSA keys" < "32 char random passwords" (depending a bit on which symbol set you're generating passwords from, and the size of your RSA keys).


Is SSO without SSL possible and/or secure? Lets imagine a site where HTTPS is not used, for any good or bad reasons. The admin of this site still need a way to secure connections and think about using unique authentication with social networks only (facebook, google, etc), assuming that the passwords will be protected since the connection (to the social network only) will be secure. The protocols used will generally be SAML, OAuth2 or OpenID.

I'm simply asking, since I do not know well the specifications of these protocols, is the secure connection between client and website host required for the unique authentication to be secure? In other words, would it be possible to sniff the payload that's keeping the user connected (I guess it's kept in the cookies) and use it?

A quick use of a search engine points me as the first hit to stackoverflow: Are Oauth2 client apps required to have SSL connection? which cites the OAuth 2.0 specification which can be summarized with:

  ... the authorization server MUST require the use of TLS ... The redirection endpoint SHOULD require the use of TLS ...  Access token credentials MUST only be transmitted using TLS

For more information see the original answer at stackoverflow.


Security of only allowing a few vetted commands using $SSH_ORIGINAL_COMMAND Using a authorized_keys forced command with ssh and a wrapper-script like this:

#!/usr/bin/env bash

case "$SSH_ORIGINAL_COMMAND" in
  /var/lib/authorized-scripts/*)
    $SSH_ORIGINAL_COMMAND
    ;;
  *)
    exit 1
    ;;
esac

Can a malicious user somehow chain another command after /usr/bin/authorized-scripts/ and therefore overcome this security measure or is this secure?

This suggests that I could simply use ssh user@host '/var/lib/authorized-scripts/script.sh && cat /etc/passwd', but this did not work in my tests.

Can I somehow improve the security of this script while still allowing multiple commands with user-supplied arguments for a single ssh key?

I am aware that the allowed commands themselves should ofcourse not allow any kind of subshells (so, find for example is a nogo for example due to its exec functionality).

Your forced command is unsafe. Consider:

ssh -l user your-server /var/lib/authorized-scripts/../../../bin/rm -rf /

The command name starts with /var/lib/authorized-scripts/ so it's safe, right? Nope!

You'll want something more along these lines:

#!/bin/sh

set -- $SSH_ORIGINAL_COMMAND
case "$1" in
  /var/lib/authorized-scripts/*)
    ;;
  *)
    exit 1
esac

command="${1#/var/lib/authorized-scripts/}"
shift
case "$command" in
  */*)
    # Simplest is to reject anything with a slash...
    exit 1
  .*)
    # ...and anything starting with dot.
    # If you need to whitelist subdirectories of /var/lib/authorized-scripts
    # then you need much more sophisticated pathname parsing and care.
    exit 1
  *)
    ;;
esac

exec "/var/lib/authorized-scripts/$command" "$@"

As for shell syntax like && and ; embedded in the command, that should be safe. As you've already discovered, such things are not interpreted by the shell in your solution but passed verbatim to the command.

However, wildcards in the arguments of the command will be interpreted. If you want to avoid that, put set -f before the line with set -- $SSH_ORIGINAL_COMMAND.

Make sure that the authorized scripts interpret their arguments in a safe way. The arguments could be options that allow shell injection (like find -exec does), file names, including symbolic links (which point to a file in a different directory), etc.

Finally: #!/usr/bin/env bash is not necessary. Your script uses no bashisms, so why not let be more portable by running under /bin/sh?


Force browser to use higher security connection How can I force my Chrome broswer (or even Firefox) to always use a higher security encryption?, for example 256bit (or more) encryption when using https.
I guess it should be some flag to force the negotiation.
I know it also depends on the other side of the connection.
I'm using Windows 7.

regards

As indicated in this answer, you can blacklist some SSL/TLS cipher suites with a command-line argument. Use SSL Labs client test to see what your browser is currently supporting, then close it and launch it again from the command-line with all the cipher suites you don't like deactivated.

Of course, not supporting some cipher suites may imply not being able to connect with some sites. For a SSL connection to succeed, both client and server must have at least one cipher suite they both support.

Also, 128 bits for symmetric keys are fine. Requiring "the biggest keys" is like buying a truck because you think that bigger cars are always better, and a 40-ton truck is undoubtedly bigger than a car. The next time you have to park your truck or pay for gas, you might somehow modify your opinion...


What all file types can we hide an archive file inside? This tutorial explains how you can "hide" an archive file like .zip inside an image file by using the command:

copy /b image.jpg + hide.zip output.jpg

Doing so allows you to right click output.jpg and just open it with winzip to read the archive. I know it's not an alternative for real encryption, but still this technique might be useful. What I want to know is what other file types does this technique work with? Any ideas?

It depends on what you mean with hiding: if you just want to hide it for transport and later strip the image again then you can do it with any file type. If instead you want to create a polyglot, i.e. a file which is both a valid image and a valid different file type at the same time, then you are restricted to types which either allow junk data at the beginning or where a valid image is a valid beginning of the file too. For example both the ZIP and the PDF standard accept junk data at the beginning although not all actual implementations accept this. And this way they can be combined into a polyglot with another file format which accepts junk at the end, like several image formats but also gzip compressed data.

I don't know of a comprehensive list of all ways file formats can be combined this way. But a classic example of an attack using such polyglot is Gifar which combines GIF and JAR into a single file to bypass restrictions. And many examples of interesting polyglots can be found in the Funky File Formats talk from 31c3.


There might be a man in the middle attack against my server I have a little $7.20/y VPS, and the fingerprint for the ECDSA key has changed three times on me. This time, it happened shortly after I reinstalled the server (same day, in fact.) I always disable password login, and make sure you can't log in with passwords. After a while, I tried logging into my server, and I got the standard error telling me about the attack. I went ahead and disabled it, and was told that the host key for the domain I was logging into was different to the one for the IP. This nearly solidifies the idea of the attack by itself, but then I was prompted for a password. What tips do you have on stopping this? I always keep UFW enabled, and only allow SSH, and public/private key authentication is the only way to get into the server (without finding an exploit, ofc.)

When a change in the fingerprint of the key is detected, it can mean a few things:

the key on the server genuinely changed - this is normal after an OS reinstallation and can happen after the sshd reinstallation
someone is posing as your server, trying a MitM attack. This is possible only with password-based authentication.

Your comment about a password-based authentication suddenly appearing out of the blue would hint about the second case.

As a side note, there is no added value for someone who already hacked into your server to change the ssh key as it will raise an alert.


Squid proxy and VPN software I have some questions about squid proxies, we set a squid proxy server to block certain web sites for users. and some users only can access  one website that related to our work.but after install some VPN software it can bypass squid proxy server. and access all web sites that blocked by squid  how this happen ?

i don't have good knowledge about how squid proxy working and how VPN software tunneling through the squid proxy, I really want to know how those things happen.

1) Part of the answer depends a lot on the kind of company you work for. I used to work at a Fortune 100 defense contractor, and I can tell you any decent IT system will red flag unknown encrypted data leaving the company network in a heartbeat. They're not looking for someone accessing blocked sites, but that kind of activity can look a lot like a sophisticated attacker has compromised the company network and is stealing data. That kind of attention will get you terminated.

2) Most companies routinely install monitoring software on company devices. It's cheap, effective at keeping employees inline, and it's a great way to document 'cause for termination' when you want to fire someone. So, you should assume they can see everything on your screen, and log everything you type at any time. All they need is a reason to come looking.

In short, most companies will terminate you pretty fast for pulling something like this. It's not a matter of if you'll get caught, but when. So, you'd better be sure watching youtube (or whatever you're up to) is worth loosing your job over.


Can a router be attacked without being associated to it's WiFi? Can an old and upatched (assume a 15 y.o. TP-Link: so plenty of vulnerabilities) be breached given:

no physical access
WEP is disabled
WPA is up but password is not crackable via aircrack-ng + johntheripper

Given the other side of the router is attached to the internet, I'd say, yes.

https://techcrunch.com/2019/05/22/tp-link-routers-vulnerable-remote-hijack/
https://www.pcwrt.com/2020/06/netgear-router-vulnerability/
https://latesthackingnews.com/2020/07/22/cisco-patched-numerous-critical-vulnerabilities-in-vpn-routers/

The list goes on and on...


Smartcard - main differences between .NET and Java smartcard? My question focuses on the differences regarding PKCS11 implementation between a .Net and a Java smartcard.

More generally, do smartcard use a specific "OS" (or firmware) and only differ in the middleware / application layer ? Is it easy to format and switch between both middleware ?

I'm rather rusty on my Smartcard stuff but I'll have a crack at an answer anyway.

Smartcards are small embedded computers in their own right and so they do indeed use a very simplified OS. The 2 you mention are the standard ones.

They all have some standard capabilities that are not especially dependent on the OS. The ability to present a certificate, encrypt/decrypt some data, request a PIN, etc are all part of the smartcard specification. These features are accessed from a host computer via a standard interface library, generally PCSC.

In addition though, most if not all smartcards of the last decade are able to act as very simple general purpose computers and that is where the differences come. Java smartcards run an embedded version of a Oracle Java as an OS and use Java as the programming language, .NET cards use an embedded version of Microsoft .NET in a similar way. Originally, there were only "dumb" smartcards and Java based "smart" smartcards. Now I believe that the .NET ones are much more common.

Hope this helps.


Tools or techniques to perform live memory capture of Solaris So far I'm hitting a brick wall here. Trying to capture memory from a Solaris 11 machine and nothing seems to work.

I've tried compiling and using LiME, to no avail
I've tried memdump, gives me garbage output
Done hours of research, can't find any tools like memoryze, DumpIt, FTKImager, etc... for Unix systems.
I've tried dumpadm (builtin command) with savecore but the files aren't in a format that is recognized by rekall, not even sure what it's producing.
Tried dd of the /dev/mem and /dev/kmem files. /dev/kmem fails, /dev/mem only copies about 600M of memory (Out of 4G) and the image isn't recognizable by rekall.

Looking for a tool or procedure that will allow me to create a .img or .raw file of the memory.

I'm not asking anyone to do this for me, but a point in the right direction would be amazing.

Standard Linux kernel programs won’t work with Solaris.

You will need to follow the procedure that Sun specifies for dumping a live system, and use their tool (mdb) for analysing.  Note that dumping a live system requires configuring the dedicated service to support it.

https://docs.oracle.com/cd/E23824_01/html/821-1451/tscrashdumps-4.html#tscrashdumps-32


How is Google Smart Lock different from the previous password management mechanism in Chrome? I am seeing a lot of hype about Smart Lock from Google. How does it differ?

One of the aspects of Smart Lock is the ability to have trusted devices.  For example, you can set your smartwatch as a trusted device for your phone, and then as long as the watch is within range, you don't need to enter a pin on your phone.  Seems a bit risky to me, so I don't use this functionality.

Other than that, it's pretty similar.  It can work with other apps as well as the Chrome browser though as well.  Not quite sure how this works, but it does say "certain mobile apps", so probably not in a very generic way.


Is it sufficient to use a hard disk magnet to corrupt/erase floppy data? I would like to make data, in many (more than 250) old floppies, unreadable/unrecoverable.

I have some HDDs that I can take apart. Their magnet is sufficient to do the job to make it unreadable to the general public? How much time it will the process take?

I don't want to destroy the floppy as I want to re-use them (some floppy art).

Yes, a HDD magnet is fine or any neodymium one and will destroy the data by sweeping such a powerful magnet across the surface of a disk. However, the reliability of such a procedure may vary.

You can also build your eraser in a similar manner to making a head demagnetizer for tapes (which is pretty simple: insulated wire, nail and an input voltage source).

If you erase your floppy disk (completely or partially) using a magnet, the track sector markers are destroyed. A quick format won't find them and therefore the format and/or any write to the disk will fail. A normal format may also fail due to not finding 1st sector marker information. However, special MS-DOS era programs may be able to re-format the disk and rebuild all track sector markers, therefore making the disk reusable.


What danger can come from D-DoS over VPN Every time I use VPN, I get a message to notify me to be sure that my PC is 'healthy' from pots infections. Also I've read in this article to stay away from that.

My question, what damage could happen to my system & network if I ignored that warning? and most important, why?

Well, first of all you have to consider that by using a VPN you are implicitly trusting the other end of the communication, as all your data will be sent there.

This exposes you to MiM attacks, as the VPN server will, by definition, be a server in the middle of your communication. For example, all your HTTP traffic can be eavesdropped, and your packets might be modified by the remote server without your knowledge (this is a broad and different topic as it depends on several factors however).

There are also chances that your VPN provider uses you as a VPN endpoint. Several free VPN servers do this (bandwith costs money). The problem is that you might be re-routing traffic from someone doing evil things through the VPN.

If you want more information on this topic, I would refer you to this page


How does the browser know windows logged in user id or Kerberos TGT? My organization uses SSO for its applications i.e. Once a user logs into his Windows 10 workstation, he accesses his web application without login. I was informed that the web applications uses NetIQ Identity Manager(IdP) and Kerberos in the background to make all this work. So during the web authentication flow, the web application first responds back with 401 Unauthorized access. The browser then sends an HTTP Authorization header. The value send by the browser is someting like "Authorization:  ".

Something gets passed in the  by the browser which the application then understands which user it is. I think its Ticket Granting Ticket(TGT) which Kerberos provided to the Windows on first login. How did the Browser get access to the TGT? Does browser has access to read the TGT from local machine?

Does browser has access to read the TGT from local machine?

Yes, that's the whole idea of Kerberos: You acquire a ticket, and then local applications can use it for auth.


What kind of encoding/hash it is I have email which is stored in Cookie :

%2FGl%F8%7E%06%F1S%FEF%10%E0T%B3%95%82BK%D9%D3%94%BC%AE%E1

which is sth like this after convert it with this tool : http://www.tareeinternet.com/scripts/unescape.html

/Glø~ñSþFàT³BKÙÓ¼®á

Does anybody have an idea what kind of hash it might be? I know email address which is stored here, but I don't want to make it public.

Based on the fact that it contains "binary" characters (those > 0x7F), it's likely it was encrypted before being stored in the cookie.  If the site wanted to encode it in a way that was publicly readable they could have used any number of ASCII-only encoding schemes.  It seems they deliberately obscured the email address to make it publicly unreadable from the cookie, while allowing them to decrypt it using a key only they know.

If you want to be exhaustive in your search for a possible encoding format, you need to interpret the characters using different character sets.  In this case though it's unlikely any character set would make sense: the email address stored is almost certainly ASCII-only, so only a non-ASCII compatible character set would generate that type of output.  UTF-16 and UTF-32 are possibilities though, if the email address was short.


Having a list of hashes for the same password compromise the security of the password? An attacker want's access to a specific account, he doesn't know the password.

It's a high entropy password. +128bits
The attacker has the hash for the password (Assuming OWASP suggested bcrypt with cost 12)
The attacker has a list with n hashes that HE KNOWS are hashes for the same password he is looking for. (He magically knows, just bear with me)

Does the list of hashes makes it easier for the attacker to gain access to the password? (Either by guessing the password of finding a collision) Or is the difficulty the same as if he had a single hash?

I'm aware it's an unlikely scenario, I'm just trying to understand more about the risks of exposed hashes.
I have very little understanding of InfoSec and hash functions, but it seems to me that the hash list makes no difference for trying to crack the password, but it could improve the chances for the attacker to find a collision. If my assumption is correct, how large would the list have to be, for it to become a realistic problem? (Ballpark estimates are fine)

It makes no difference, and the scenario makes no sense at all.
If you think about the salt and oversimplify it, it's just a string concatenated with the password, and that makes the password different. So you will never have n hashes for the same password, you will have n hashes for n different passwords.
Even one bit changed on a salt makes the hash completely different (due to the Avalanche effect), so the attacker sits on a pile of random, useless data.


Active Directory password complexity based onto entropy I am evaluating the possibility to enable password complexity rules into my Active Directory, but the rules it offers are for me not good. So I would like to have a complexity rule based onto only two factors:

password length: at least 12/14/16 chars
a good entropy

Is it possibile to improve AD with this kind of rule?

Yes. You would need to create a custom Password Filter, but it's not a point and click function. See this Microsoft article on how to do so: Custom Password Filter

There are also a number of third party password filters available that may make it easier for you (e.g. NFront, SpecOps, etc.)


Finding all links under a website How can i find all directories and links under a website? Note that there is no link from home page to all other pages. For example if i have a domain like this users.company.com and each user will have a link like users.company.com/john, users.company.com/peter etc. But i don't know how many users are there what are all the links and i want to brute force to check all links. Is there any tool or website providing this service? If i want to write a python script to do this job, where can i get information to develop this in python?

There is a program called dir-buster developed by the OWASP project which i believe will do exactly what you want, to brute-force file and folder names
To quote the site:

DirBuster is a multi threaded java application designed to brute force
directories and files names on web/application servers. Often is the
case now of what looks like a web server in a state of default
installation is actually not, and has pages and applications hidden
within. DirBuster attempts to find these.

And you should be aware that:

Tools of this nature are often as only good as the directory and file list they come with.
Just make sure that you've updated this list with any data you can to assist it in finding these folders.

Hope that helps answer your question!


Is it safe for GPG to compress all messages prior to encryption by default? By default, GPG compresses text during encryption.

Additionally, RFC 4880 says:

  2.3.  Compression

  OpenPGP implementations SHOULD compress the message after applying the signature but before encryption.

We know that encryption does not attempt to hide the data length, and that in certain circumstances, this property makes it possible for an attacker who can execute a limited chosen plaintext attack to learn more about the full plaintext (see CRIME, BREACH, etc.).

To quote Thomas Pornin:

  The one-line executive summary is that thou shalt not compress.

Is it safe behavior for OpenPGP implementations to compress messages by default? Does it make sense to disable this behavior?

Encryption leaks data length: for any given input message, the encrypted output will have a length which will be close to that of the input message. If using a padding-less encryption mode (e.f. CFB, as used in the OpenPGP format that PGP implements), then the cleartext data length can be recovered exactly. This is a property common to all encryption systems, and it is the reason why traffic analysis is a powerful attack tool.

Compression does not qualitatively change this issue, but it can worsen it. Compression makes data length dependent on data contents, so it can leak extra information. For instance, consider a payment system for some Web site: the customer sends his credit card information to the site, which then forwards the credit card number, along with the transfer amount and the current date, to a partner bank. Suppose that each such message is to be encrypted with OpenPGP, and has a fixed-length format (16 characters for the credit card number, and so on). The fixed length is meant to deter traffic analysis. However, with compression active, this is not so: the message will be shorter if the amount or the current date contains digit patterns which are also found in the credit card number. The attacker knows the current date, and can infer the transfer amount (it must match the price of one of the items which are sold on the site), so the leak can be exploited to gain some partial information on the credit card number.

It is all a matter of context. The Web and HTTPS offer some characteristics which make exploitation quite effective:

The victim's browser includes the target secret (a cookie) in each request it sends, at a predictable place, and always the same value.
The attacker can inject hostile code (Javascript) which can arrange for triggering requests at will, hundreds of them, without anything showing up on the user's screen.
The hostile code from the attacker gets to add a lot of data of its own choosing along with the secret value. This is a chosen-plaintext attack.

Thanks to these characteristics, CRIME works (well, not anymore since browsers don't support TLS-level compression, but it used to work). But they don't apply to usual OpenPGP usage contexts. PGP was meant for emails, with a human painfully typing each message, and another human reading them at the other end. No hostile code, no or very little chosen plaintext, and the fuzziness of human language moving around secret values.

Hence, we can say that the normal usage scenario of PGP is such that compression does not substantially degrades security, which justifies its use by default. Although, to be fair, PGP does not compress by default because it is usually safe; it compresses by default because that's what it did twenty years ago, and old habits die hard. In the beginning, the compression was there to make up for the overhead of encryption, mostly the extra few hundred bytes for the asymmetric cryptography, and the +33% size increase implied by Base64 encoding. With recent hardware and networks, this is hardly relevant; PGP compresses out of Tradition more than anything else.

To conclude, an enlightening story. In early 1942, the US Navy was trying to prepare for the next Japanese attack after Pearl Harbor and the battle of the Coral Sea. The target was known under a code name in the Japanese communications. To confirm its identification, the Americans deliberately sent fake messages among the normal transit of routine messages, in order to see that information show up in the Japanese stream and correlate it. In this specific case, they claimed that their base at Midway had a broken distiller. The Japanese encoded transmissions reported that the target for the next attack was short on water. This crucial information was instrumental to the Japanese defeat, after which it all went downhill for Japan until the end of World War II. (Even Wikipedia has pointers on this anecdote, so it is not only a nice story, but it might even be true.)

This is a chosen-plaintext attack all right, coupled with traffic analysis. The important point, for the present discussion, is that routine messages are computer-like: though it was in 1942, military behaviour can be considered to emulate a mindless computer. The chosen-plaintext attack could be pulled off because it took place in a context where the victim (here, the Japanese communication network) could reliably be made to relay chosen information, in its own coding system, with a predictable format.

The same applies to PGP. If you use PGP in the traditional way, for handcrafted text messages, to communicate from a human brain to another, then compression is safe. If you use PGP in an automated way, to send lots of messages in a predictable format with contents that can mostly be guessed or even chosen by attackers, then compression may substantially increase your security issues.


SQL Injection query error with backslash I have a sql injection vulnerable site which works well if i input query like this qq' -- // or qq' -- ; . But when i inject without slash or semi-colon it throws following error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--%'' at line 1"

So what is the use of slash or semi-colon in the query, please explain the scenario.

MySQL’s comment syntax requires a whitespace or control character after the --:

  From a “-- ” sequence to the end of the line. In MySQL, the “-- ” (double-dash) comment style requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on). This syntax differs slightly from standard SQL comment syntax, as discussed in Section 1.7.2.4, “'--' as the Start of a Comment”.

The additionally included character in your cases probably just prevents the removal of the trailing whitespace or control character required by MySQL.


Password hashing using hash functions I am curious to know two facts regarding MD5 password hashing. As far I know, MD5 is faster and more vulnerable to collision than other hash functions like SHA-1,SHA-3 etc.

To prevent dictionary attack, brute-force attack and rainbow table attack different people have developed different techniques over time.

For example,one of the techniques is adding some random messages with the original passwords to prevent rainbow table attack and using recursive or iterative hashing to make the entire password hashing slower.

Then the hashed values are stored in a database. A user enters his username and password at the login screen and then the client-server system
computes the hashed value immediately and match it with the hashed values previously stored in the database.

I present my curiosity in the form of two questions.

Isn't making password hashing slower using recursion or iteration same as making the login slower for the users?
Are password hashing techniques made generally secret or open to others.

For example,one of the techniques is adding some random messages with the original passwords to prevent rainbow table attack

Making the hash function slower (increasing the work factor) makes it harder to break, but adding a random salt doesn't doesn't make the hash harder to break at all, that's not what it's supposed to do.

What it does is protect two or more users who all have the same password. A hash of the same input will always have the same output - so all the users with the same hash in the database must have the same password. If you crack one, you get them all.

Adding a random salt to each password makes their hashes different, so the rainbow table cracks only one at a time.

  Isn't making password hashing slower using recursion or iteration same as making the login slower for the users?

Yes.

If password verification was a fast hash, attackers can check lots of passwords quickly and find the right one. So hash functions for passwords should be slow to protect against that. And their normal use is a person typing and watching a login screen, waiting half a second, once, is not a bad trade off.

Some are slow by design (bcrypt) and some are slow by doing a fast hash over and over (pbkdf2).

Scrypt is a variant on this idea as well - a hash which makes the calculation take a lot of time, and also makes it take a lot of memory to do - so trying to attack it fast by using multiple computers is expensive.

https://codahale.com/how-to-safely-store-a-password/ discusses this tradeoff with examples.

  Are password hashing techniques made generally secret or open to others.

Generally open. An older hash (now deprecated) was RC4, and that was a proprietary development by the company RSA Security, and never officially released, but it leaked, was confirmed, and widely used anyway.

Common password hashing algorithms (slow) are open:

bcrypt, which was publically released and is used in OpenBSD, which is open source.

or official standards through the Internet Engineering TaskForce (IETF):

RFC 2898 - PBKDF2

Common fast hashing algorithms (used in SSH, IPSEC, TLS) are open standards too, e.g.

RFC 1320 - MD4, 1992
RFC 1321 - MD5, 1992
RFC 3174 - SHA1, 2001
RFC 3874 - SHA224, 2004

and there's also RFC 6234 which says "The United States of America has adopted a suite of Secure Hash Algorithms (SHAs) [..] namely SHA-224, SHA-256, SHA-384, and SHA-512. This document makes open source code performing these SHA hash functions conveniently available to the Internet community.".

Alternatives to PBKDF2 Argon2 and Lyra2 are open source as well.

That's not to say that people can't make proprietary closed hashing algorithms, or base their password hashes on fast algorithms, but [Microsoft makes use of MD5] in Active Directory password hashes, and lots of companies use PBKDF2.

(In fact, I'd be curious to find proprietary hash functions used in popular systems, I can't think that I know of any)


Will resize of an image execute the file? Our server was exploited by a ransomware. We allow admins to upload PDF, docx, excel etc. But also images and SVG.

And we use dragonfly to generate thumbnails on those files that are supported.

Let's say I upload a infected image to the server.

When resizing images with imagemagick, are the files being executed or just read? Can a resize jeopardize the security of a server?

Unless you have a bug in your image handling tools code the image gets only read and no code executed which might reside somewhere in the image. But note that in the past there were bugs in image handling code which lead to code execution, for example this bug in libjpeg.  Thus to be on the safer side you should do your image manipulation within a restricted environment like some kind of sandbox.


Linux: Can unprivileged users tamper with processes running under their own identity? Having the following pseudocode executed by a superuser, is it safe to assume that it is secure on Linux?
if fork() == 0:
   # drop privileges to an unprivileged user, let's say "nobody"
   # perform various tasks, start other processes as "nobody"
   # communicate with parent process through unsafe means, e.g. Python pickle

Now, Pickle is known to be susceptible to RCE if the data to be unpickled comes from an untrusted source. Although I assume my own code to be free of vulnerabilities, my concern is that the above code could still be vulnerable to privilege escalation through another process running as "nobody" that tampers with the memory of the unprivileged fork. If "nobody" could tamper with the memory of the process, it could potentially inject a pickled object which then leads to remote code execution in the parent process, i.e. as root user, which would be a privilege escalation. On the systems I tested this on, e.g. through writing to /proc/$pid/mem, I was able to tamper with the memory of another process only as superuser. However, I prefer to not just rely on a few tests on Linux machines where the behavior could depend on the distribution/configuration.
So my question is: Is this code secure? If so, where can I find a documentation guaranteeing that this behavior is universally secure? Alternatively, is there an argument that shows that a system would be inherently unsafe if it allowed an unprivileged user to tamper with all other processes running under their user id?
A question on how to implement secure child-to-parent communication in a setting where the child drops permissions has already been asked on Stackoverflow and since the accepted answer uses pickling under the hood, my question boils down to whether this approach is really secure.

If you start a process as yourself and you can't trust that other process, then yes, all your processes are vulnerable.
Root can generally access everything unless you have LinuxSE in which case root is not allowed to access other user's processes (at least by default), it can still see that they are running and send signals, though.
If you want to start another process in a more secure way, you have to

fork()
start a process that can change to that other user (i.e. suid bit set)
change to that other user
start the possibly non-secure process as that other user

systemd does a lot of that with services. Many services run as a user that's not root. In some cases, though, it starts as root (apache2) and change to another user later (www-data under Ubuntu) so the processes actually dealing with client connections are not running as root. But root is required to open port 80 and 443 (below 1024).
Actually systemd also has an option that defines how many child processes your service can start. It can be set to 0 in which case a simple system() call will fail every time (very strange when you don't know that the OS is capable of controlling that!) So there is definitely a potential security issue in starting any other process you're not 100% in control of. At the same time, this is very much the Unix way.
Another solution is to run everything in a docker so at least the main server can't be attacked directly. Your docker may get hacked, but you can always re-install and restart quickly (and work on a fix to prevent the hack from happening again, after you blocked that IP address in iptables).