Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port ranges should be limited to OS port limits #1772

Open
IvanDrag0 opened this issue Apr 24, 2023 · 11 comments
Open

Port ranges should be limited to OS port limits #1772

IvanDrag0 opened this issue Apr 24, 2023 · 11 comments
Labels

Comments

@IvanDrag0
Copy link

Describe the bug

Currently, the OSCAL schema allows the user to add a network port range (part of the oscal-implementation-common) model. However, an OS (Windows and Linux) has a logical port range of 0-65535, while the schema allows for any number. The schema should be edited to bound the port range to what an OS can utilize.

Who is the bug affecting

Component and POAM writers. This "bug" is more of a sanity check than anything else.

What is affected by this bug

Metaschema, Modeling

How do we replicate this issue

Set the protocol port range to any number.

Expected behavior (i.e. solution)

The protocol port range should only allow whole numbers between 0 and 65535.

Other comments

No response

Revisions

No response

@IvanDrag0 IvanDrag0 added the bug label Apr 24, 2023
@GaryGapinski
Copy link

This is an apt observation.

I will add that the "obvious" reserved ports (see IANA Service Name and Transport Protocol Port Number Registry) should be excluded (namely, 0, 1023, 1024, 49151). I say "obvious" because other port reservations are dependent on transport type as well as historic IANA actions.

See also #1674.

@IvanDrag0
Copy link
Author

So does that mean that the current OSCAL schema already support this feature? Since #1674 has been merged.

Except port 0 (since it's a wildcard port), I don't think it would be a good idea to exclude known protocols since some systems could use those ports for something else (even though they shouldn't).

Also, I'm not sure if it's possible to do with a JSON/XML schema, but adding a check to make sure that multiple components dont have the same ports/port ranges, might be a good idea.

@GaryGapinski
Copy link

GaryGapinski commented Apr 24, 2023

So does that mean that the current OSCAL schema already support this feature? Since #1674 has been merged.

As of pre-release v1.0.5 there are no [edit: additional] constraints — in the schema — on start and end.

Placing the constraints I mentioned is possible.

@GaryGapinski
Copy link

Also, I'm not sure if it's possible to do with a JSON/XML schema, but adding a check to make sure that multiple components dont have the same ports/port ranges, might be a good idea.

Such is not possible with a simple schema. It is possible using Schematron for XML.

Components may share port usage. For example, multiple components using the HTTPS protocol might all declare the use of port 443.

Worthy of note:component/protocol/port-range does not denote the nature (client or service) of the component.

@IvanDrag0
Copy link
Author

Worthy of note:component/protocol/port-range does not denote the nature (client or service) of the component.

This is actually a good point. With the current rise of web-based applications and interfaces, it might be a good idea to include a client/server tag and/or add network direction (ingress/egress/both).

@aj-stein-nist aj-stein-nist moved this from Todo to Further Analysis Needed in NIST OSCAL Work Board Sep 20, 2023
@brian-ruf
Copy link
Contributor

I just came across this thread while researching an unrelated port start/end issue.

While I can agree with the idea of limiting ports to only those possible in the IP specification (0 - 65,535), I want to caution that the IANNA registry is to govern the public Internet. It is possible that private, air-gapped networks are using those reserved ports without issue, and would still need to document them via OSCAL.

When limiting ports, please stick only to the IP spec as originally suggested by @IvanDrag0 .

@IvanDrag0
Copy link
Author

Hi @brian-ruf,

Thank you for taking a look at the issue. When you mention "reserved ports", are you referring to ports above 65,535? Since a TCP/UDP port is an unsigned integer, it has a maximum of 65,535. Anything above that would not be an unsigned integer and the OS will not be able to process it.

@aj-stein-gsa
Copy link
Contributor

I just came across this thread while researching an unrelated port start/end issue.

While I can agree with the idea of limiting ports to only those possible in the IP specification (0 - 65,535), I want to caution that the IANNA registry is to govern the public Internet. It is possible that private, air-gapped networks are using those reserved ports without issue, and would still need to document them via OSCAL.

@brian-ruf, how could you use reserved or IANA specifications that are not within the IPv4 specification limit of those ranges? Or are we talking about the protocol/@name flag here and I got confused by the implication here?

@brian-ruf
Copy link
Contributor

I was agreeing the OSCAL spec should constrain the port values to the IP spec of 0 - 65,535. Full stop.

I was expressing concern with the suggestion that the OSCAL spec also probits the use of IANNA reserved port numbers.

I do not agree with OSCAL syntax validation blocking IANNA reserved ports in the port field for several reasons.

The SSP and AR are for documenting actual configuration of a system.

There is a small chance air gapped or non-Internet routed networks are not compliant with IANNA. They don't need to be. OSCAL syntax should not block the accurate documentation of these networks.

Also, a system may be configured and functioning, while inadvertantly using an IANNA reserved port. OSCAL validation rules should not block content authors from reporting this in SSP or AR content.

Finally, those ports are reserved for a reason. They are only to be used in certain circumstances that don't apply to most systems. But, there may be a system that needs to use them for that reserved purpose. OSCAL syntax enforcement shouldn't block this.

Again, I 100% support a constraint that limits the port field values to the range 0 - 65,535, but view additional blocking of IANNA reserved port enforcement as an over-reach for OSCAL syntax validation.

@aj-stein-gsa
Copy link
Contributor

aj-stein-gsa commented Nov 13, 2024

I was agreeing the OSCAL spec should constrain the port values to the IP spec of 0 - 65,535. Full stop.

OK, thanks for confirming.

I was expressing concern with the suggestion that the OSCAL spec also probits the use of IANNA reserved port numbers.

I do not agree with OSCAL syntax validation blocking IANNA reserved ports in the port field for several reasons.

The SSP and AR are for documenting actual configuration of a system.

There is a small chance air gapped or non-Internet routed networks are not compliant with IANNA. They don't need to be. OSCAL syntax should not block the accurate documentation of these networks.

That is understandable, but that rationale over-extends what IANA (and IETF RFC 6335) document as reasons for reserved ports without registered port numbers and/or protocol names; you they do not necessarily only occur in air-gapped or other than those protocols that not routed on Internet.

o Reserved: Reserved port numbers are not available for regular
assignment; they are "assigned to IANA" for special purposes.
Reserved port numbers include values at the edges of each range,
e.g., 0, 1023, 1024, etc., which may be used to extend these
ranges or the overall port number space in the future.

In order to keep the size of the registry manageable, IANA typically
only records the Assigned and Reserved service names and port numbers
in the registry. Unassigned values are typically not explicitly
listed. (There are very many Unassigned service names and
enumerating them all would not be practical.)

That said, given what you did write here, the rationale does not matter. I agree to your point here. It would seem, having the name flag for a given protocol as required, separating of defining any port range is part of the issue at hand here. Anything service can use a port with the 16-bit range allowed by TCP/UDP/transport protocols inside of IPv4 and IPv6, so we should not force a name. The documents indicate that is commonly the IANA service name. That, or in OSCAL we have people add superfluous names like "other" or "private" or "reserved" without merit.

aj-stein-gsa added a commit to aj-stein-gsa/OSCAL that referenced this issue Nov 13, 2024
Per discussion with community members and the nature of port, protocol,
and service declarations in a OSCAL SSP model instances for RMF use
cases, like FedRAMP and others. It would appear the model, per the
Metaschema declarations and documentation, require a port range has a
name that is commonly the IANA service name, which should be optional.
Otherwise, developers and security officials will need to create an
arbitrary name that does not strictly conform to the documentation. More
details can be found in the issue thread referenced below by URL.

usnistgov#1772 (comment)
@aj-stein-gsa
Copy link
Contributor

For others interested in this topic and a possible fix that is conducive to comments made above, I have proposed #2069 for consideration as part of a possible patch release (e.g. 1.1.3 release).

aj-stein-gsa added a commit to aj-stein-gsa/OSCAL that referenced this issue Nov 15, 2024
Per discussion with community members and the nature of port, protocol,
and service declarations in a OSCAL SSP model instances for RMF use
cases, like FedRAMP and others. It would appear the model, per the
Metaschema declarations and documentation, require a port range has a
name that is commonly the IANA service name, which should be optional.
Otherwise, developers and security officials will need to create an
arbitrary name that does not strictly conform to the documentation. More
details can be found in the issue thread referenced below by URL.

usnistgov#1772 (comment)
iMichaela pushed a commit that referenced this issue Nov 15, 2024
Per discussion with community members and the nature of port, protocol,
and service declarations in a OSCAL SSP model instances for RMF use
cases, like FedRAMP and others. It would appear the model, per the
Metaschema declarations and documentation, require a port range has a
name that is commonly the IANA service name, which should be optional.
Otherwise, developers and security officials will need to create an
arbitrary name that does not strictly conform to the documentation. More
details can be found in the issue thread referenced below by URL.

#1772 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Further Analysis Needed
Development

No branches or pull requests

4 participants